page_edit
Allows adding of custom fields to the info page editing form.
Helpdesk
Input (passed by reference)
$params['url'] string Page URL.
$params['url_decoded'] string Page URL, containing national alphabet characters, decoded from a Punycode form to Unicode.
$params['page'] array Associative array of the page being edited, from the database table helpdesk_page.
$params['preview_hash'] string Unique key used in the page draft preview link URL.
$params['url_decoded'] string Page URL, containing national alphabet characters, decoded from a Punycode form to Unicode.
$params['page'] array Associative array of the page being edited, from the database table helpdesk_page.
$params['preview_hash'] string Unique key used in the page draft preview link URL.
… your plugin code …
Output
{$page_edit.%plugin_id%}
HTML code of custom page editing fields.
Helpdesk
Plugin code example
PHP
public function pageEdit($params) { $fields_values = helpdeskMyPlugin::getFieldsValues($params['page']['id']); $fields = [ 'field1' => [ 'control_type' => waHtmlControl::INPUT, 'title' => _wp('Field 1'), ], 'field2' => [ 'control_type' => waHtmlControl::TEXTAREA, 'title' => _wp('Field 2'), ], ]; $html = array_reduce( array_keys($fields), function ($result, $field_name) use ($fields, $fields_values) { $result .= waHtmlControl::getControl($fields[$field_name]['control_type'], $field_name, $fields[$field_name] + [ 'control_wrapper' => '<div class="field"><div class="name">%s</div><div class="value">%s%s</div></div>', 'title_wrapper' => '%s', 'namespace' => 'myplugin', 'value' => ifset($fields_values, $field_name, ''), ]); return $result; }, '' ); return $html; }