Status editor hook
This commit is contained in:
parent
cc9ca8bbff
commit
ff20370d0b
@ -122,7 +122,7 @@ class Article_edit extends \Zotlabs\Web\Controller {
|
||||
'bbcode' => (($mimetype == 'text/bbcode') ? true : false)
|
||||
);
|
||||
|
||||
$editor = status_editor($a, $x);
|
||||
$editor = status_editor($a, $x, false, 'Article_edit');
|
||||
|
||||
$o .= replace_macros(get_markup_template('edpost_head.tpl'), array(
|
||||
'$title' => t('Edit Article'),
|
||||
|
@ -132,7 +132,7 @@ class Articles extends Controller {
|
||||
$x['title'] = $_REQUEST['title'];
|
||||
if($_REQUEST['body'])
|
||||
$x['body'] = $_REQUEST['body'];
|
||||
$editor = status_editor($a,$x);
|
||||
$editor = status_editor($a,$x,false,'Articles');
|
||||
|
||||
}
|
||||
else {
|
||||
|
@ -109,7 +109,7 @@ class Blocks extends \Zotlabs\Web\Controller {
|
||||
if($_REQUEST['pagetitle'])
|
||||
$x['pagetitle'] = $_REQUEST['pagetitle'];
|
||||
|
||||
$editor = status_editor($a,$x);
|
||||
$editor = status_editor($a,$x,false,'Blocks');
|
||||
|
||||
|
||||
$r = q("select iconfig.iid, iconfig.k, iconfig.v, mid, title, body, mimetype, created, edited from iconfig
|
||||
|
@ -122,7 +122,7 @@ class Card_edit extends \Zotlabs\Web\Controller {
|
||||
'bbcode' => (($mimetype == 'text/bbcode') ? true : false)
|
||||
);
|
||||
|
||||
$editor = status_editor($a, $x);
|
||||
$editor = status_editor($a, $x, false, 'Card_edit');
|
||||
|
||||
$o .= replace_macros(get_markup_template('edpost_head.tpl'), array(
|
||||
'$title' => t('Edit Card'),
|
||||
|
@ -133,7 +133,7 @@ class Cards extends Controller {
|
||||
if($_REQUEST['body'])
|
||||
$x['body'] = $_REQUEST['body'];
|
||||
|
||||
$editor = status_editor($a, $x);
|
||||
$editor = status_editor($a, $x, false, 'Cards');
|
||||
}
|
||||
else {
|
||||
$editor = '';
|
||||
|
@ -168,7 +168,7 @@ class Channel extends Controller {
|
||||
'reset' => t('Reset form')
|
||||
);
|
||||
|
||||
$o .= status_editor($a,$x);
|
||||
$o .= status_editor($a,$x,false,'Channel');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ class Display extends \Zotlabs\Web\Controller {
|
||||
);
|
||||
|
||||
$o = '<div id="jot-popup">';
|
||||
$o .= status_editor($a,$x);
|
||||
$o .= status_editor($a,$x,false,'Display');
|
||||
$o .= '</div>';
|
||||
}
|
||||
|
||||
|
@ -132,7 +132,7 @@ class Editblock extends \Zotlabs\Web\Controller {
|
||||
'bbcode' => (($mimetype == 'text/bbcode') ? true : false)
|
||||
);
|
||||
|
||||
$editor = status_editor($a, $x);
|
||||
$editor = status_editor($a, $x, false, 'Editblock');
|
||||
|
||||
$o .= replace_macros(get_markup_template('edpost_head.tpl'), array(
|
||||
'$title' => t('Edit Block'),
|
||||
|
@ -131,7 +131,7 @@ class Editlayout extends \Zotlabs\Web\Controller {
|
||||
'profile_uid' => intval($owner),
|
||||
);
|
||||
|
||||
$editor = status_editor($a, $x);
|
||||
$editor = status_editor($a, $x, false, 'Editlayout');
|
||||
|
||||
$o .= replace_macros(get_markup_template('edpost_head.tpl'), array(
|
||||
'$title' => t('Edit Layout'),
|
||||
|
@ -102,7 +102,7 @@ class Editpost extends \Zotlabs\Web\Controller {
|
||||
'bbcode' => true
|
||||
);
|
||||
|
||||
$editor = status_editor($a, $x);
|
||||
$editor = status_editor($a, $x, false, 'Editpost');
|
||||
|
||||
$o .= replace_macros(get_markup_template('edpost_head.tpl'), array(
|
||||
'$title' => t('Edit post'),
|
||||
|
@ -160,7 +160,7 @@ class Editwebpage extends \Zotlabs\Web\Controller {
|
||||
'bbcode' => (($mimetype == 'text/bbcode') ? true : false)
|
||||
);
|
||||
|
||||
$editor = status_editor($a, $x);
|
||||
$editor = status_editor($a, $x, false, 'Editwebpage');
|
||||
|
||||
$o .= replace_macros(get_markup_template('edpost_head.tpl'), array(
|
||||
'$title' => t('Edit Webpage'),
|
||||
|
@ -138,7 +138,7 @@ class Hq extends \Zotlabs\Web\Controller {
|
||||
[
|
||||
'$no_messages' => (($target_item) ? false : true),
|
||||
'$no_messages_label' => [ t('Welcome to Hubzilla!'), t('You have got no unseen posts...') ],
|
||||
'$editor' => status_editor($a,$x)
|
||||
'$editor' => status_editor($a,$x,false,'Hq')
|
||||
]
|
||||
);
|
||||
|
||||
|
@ -141,7 +141,7 @@ class Layouts extends \Zotlabs\Web\Controller {
|
||||
if($_REQUEST['pagetitle'])
|
||||
$x['pagetitle'] = $_REQUEST['pagetitle'];
|
||||
|
||||
$editor = status_editor($a,$x);
|
||||
$editor = status_editor($a,$x,false,'Layouts');
|
||||
|
||||
$r = q("select iconfig.iid, iconfig.v, mid, title, body, mimetype, created, edited, item_type from iconfig
|
||||
left join item on iconfig.iid = item.id
|
||||
|
@ -196,7 +196,7 @@ class Network extends \Zotlabs\Web\Controller {
|
||||
$x['pretext'] = $deftag;
|
||||
|
||||
|
||||
$status_editor = status_editor($a,$x);
|
||||
$status_editor = status_editor($a,$x,false,'Network');
|
||||
$o .= $status_editor;
|
||||
|
||||
$static = channel_manual_conv_update(local_channel());
|
||||
|
@ -81,7 +81,7 @@ class Pubstream extends \Zotlabs\Web\Controller {
|
||||
);
|
||||
|
||||
$o = '<div id="jot-popup">';
|
||||
$o .= status_editor($a,$x);
|
||||
$o .= status_editor($a,$x,false,'Pubstream');
|
||||
$o .= '</div>';
|
||||
}
|
||||
|
||||
|
@ -138,7 +138,7 @@ class Rpost extends \Zotlabs\Web\Controller {
|
||||
'jotnets' => true
|
||||
);
|
||||
|
||||
$editor = status_editor($a,$x);
|
||||
$editor = status_editor($a,$x,false,'Rpost');
|
||||
|
||||
$o .= replace_macros(get_markup_template('edpost_head.tpl'), array(
|
||||
'$title' => t('Edit post'),
|
||||
|
@ -208,7 +208,7 @@ class Webpages extends Controller {
|
||||
if(! $r)
|
||||
$x['pagetitle'] = 'home';
|
||||
|
||||
$editor = status_editor($a,$x);
|
||||
$editor = status_editor($a,$x,false,'Webpages');
|
||||
|
||||
$pages = null;
|
||||
|
||||
|
31
doc/hook/status_editor.bb
Normal file
31
doc/hook/status_editor.bb
Normal file
@ -0,0 +1,31 @@
|
||||
[h2]status_editor[/h2]
|
||||
|
||||
Replace the default status_editor (jot).
|
||||
|
||||
Allow plugins to replace the default status editor in a context dependent manner.
|
||||
|
||||
It is fed an array of ['editor_html' => '', 'x' => $x, 'popup' => $popup, 'module' => $module].
|
||||
|
||||
All calls to the status_editor at the time of the creation of this hook have been updated
|
||||
to set $module at invocation. This allows addon developers to have a context dependent editor
|
||||
based on the Hubzilla module/addon.
|
||||
|
||||
Calls to status_editor() are in the form of:
|
||||
status_editor($a, $x, $popup, $module).
|
||||
|
||||
Future module/addon developers are encouraged to set $popup and $module when invoking the
|
||||
status_editor.
|
||||
|
||||
|
||||
[code]
|
||||
$hook_info = ['editor_html' => '', 'x' => $x, 'popup' => $popup, 'module' => $module];
|
||||
call_hooks('status_editor',$hook_info);
|
||||
if ($hook_info['editor_html'] == '') {
|
||||
return hz_status_editor($a, $x, $popup);
|
||||
} else {
|
||||
return $hook_info['editor_html'];
|
||||
}
|
||||
|
||||
[/code]
|
||||
|
||||
see: include/conversation.php
|
@ -595,6 +595,9 @@ Hooks allow plugins/addons to "hook into" the code at many points and alter the
|
||||
[zrl=[baseurl]/help/hook/smilie]smilie[/zrl]
|
||||
Called when translating emoticons
|
||||
|
||||
[zrl=[baseurl]/help/hook/status_editor]status_editor[/zrl]
|
||||
Called when generating the status_editor.
|
||||
|
||||
[zrl=[baseurl]/help/hook/stream_item]stream_item[/zrl]
|
||||
Called for each item which is rendered for viewing via conversation()
|
||||
|
||||
|
@ -1232,13 +1232,27 @@ function format_like($cnt, $arr, $type, $id) {
|
||||
return $o;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Wrapper to allow addons to replace the status editor if desired.
|
||||
*/
|
||||
function status_editor($a, $x, $popup = false, $module='') {
|
||||
$hook_info = ['editor_html' => '', 'x' => $x, 'popup' => $popup, 'module' => $module];
|
||||
call_hooks('status_editor',$hook_info);
|
||||
if ($hook_info['editor_html'] == '') {
|
||||
return hz_status_editor($a, $x, $popup);
|
||||
} else {
|
||||
return $hook_info['editor_html'];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This is our general purpose content editor.
|
||||
* It was once nicknamed "jot" and you may see references to "jot" littered throughout the code.
|
||||
* They are referring to the content editor or components thereof.
|
||||
*/
|
||||
|
||||
function status_editor($a, $x, $popup = false) {
|
||||
function hz_status_editor($a, $x, $popup = false) {
|
||||
|
||||
$o = '';
|
||||
|
||||
|
Reference in New Issue
Block a user