Skip to content

Enhancement: Using markdown and moodle filters for the flagmessage #932

@fhkevin

Description

@fhkevin

Proposal

Instead of using a plain text element for the flagmessage, which doesn't even allow line breaks inside the message:

echo $OUTPUT->box($msg, 'generalbox', 'notice');

we could allow markdown:

$context = $PAGE->context ?? context_system::instance();
$markdown = format_text($msg, FORMAT_MARKDOWN, [
    'context' => $context,
    'filter'  => true,
]);
echo $OUTPUT->box($markdown, 'generalbox', 'notice');

This allows formatting and also the use of the {mlang} modifier directly inside the flagmessage field in the Settings GUI:

{mlang en}
## Test-heading english
info-text english
{mlang}

{mlang en}
## Test-heading german
info-text german
{mlang}

Environment

  • Moodle: 4.5.7
  • Auth SAML2 Plugin: latest MOODLE_405_STABLE release

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions