source_editor

Allows adding of custom content to source settings pages.

Helpdesk

Input (passed by reference)

$params['source'] helpdeskSource Source class instance.
$params['source_type'] helpdeskSourceType Source type class instance.
$params['workflow'] helpdeskWorkflow Workflow class instance.
$params['form_html'] string HTML code of the source settings form. Can be modified by a plugin.
… your plugin code …

Output

%plugin_id%
Custom content at the bottom of the source settings page.
Helpdesk

Plugin code example

PHP

public function sourceEditor(&$params)
{
    if ($params['source_type']->getType()  == 'email') {
        $fields = [
            'myinput' => [
                'control_type' => waHtmlControl::INPUT,
                'title' => _wp('My input'),
                'description' => _wp('Input description'),
            ],
            'mytextarea' => [
                'control_type' => waHtmlControl::INPUT,
                'title' => _wp('My textarea'),
                'description' => _wp('Textarea description'),
            ],
        ];

        $fields_html = array_reduce(array_keys($fields), function($result, $field) use ($fields) {
            $result .= waHtmlControl::getControl($fields[$field]['control_type'], $field, $fields[$field] + [
                'namespace' => 'myplugin',
                'control_wrapper' => '<div class="field"><div class="name">%s</div><div class="value">%s%s</div></div>',
                'title_wrapper' => '%s',
                'description_wrapper' => '<br><span class="hint">%s</span>',
            ]);

            return $result;
        }, '');

        $fields_html = '<div class="fields width100px">
                <div class="field">
                    <div class="name"><h5 class="heading">' . _wp('My plugin') . '</h5></div>
                    <div class="value">' . $fields_html . '</div>
                </div>
            </div>';

        return $fields_html;
    }
}