backend_followup_edit

Allows adding custom content to followup message editing page.

Shop-Script

Input (passed by reference)

$followup array Followup message properties.
… your plugin code …

Output

{$backend_followup_edit}
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 backendFollowupEdit($followup)
{
    $subject = $followup['subject'];
    $subject_is_short = mb_strlen($subject) < self::MIN_FOLLOWUP_SUBJECT_LENGTH;

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

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