backend_notification_edit

Allows adding custom content to the order action notification editing page.

Shop-Script

Input (passed by reference)

$params['notification'] array Main notification properties from table 'shop_notification'.
$params['params'] array Additional notification properties from table 'shop_notification_params'.
… your plugin code …

Output

$return
Custom HTML code. By default, it is placed within a hidden block; therefore it might be useful to also add some JavaScript code to display that hidden block.
Shop-Script

Plugin code example

PHP

public function backendNotificationEdit($params)
{
    $notification = $params['notification'];
    $notification_params = $params['params'];

    $subject = $notification_params['subject'];
    $subject_is_short = mb_strlen($subject) < self::MIN_SUBJECT_LENGTH;

    if ($subject_is_short) {
        $message = sprintf_wp('Too short subject for notification “%s”: “%s”.', $notification['name'], $subject);

        return <<<HTML
            <div class="box state-error">
                {$message}
            </div>
            <script>
                \$('.notification-plugin-wrapper.edit.{$this->id}-plugin').removeClass('hidden');
            </script>
HTML;
    }
}