Skip to content

Instantly share code, notes, and snippets.

@marxjohnson
Created November 20, 2018 09:06
Show Gist options
  • Save marxjohnson/3abc5e2abecd62b0ed330972ba3a4f13 to your computer and use it in GitHub Desktop.
Save marxjohnson/3abc5e2abecd62b0ed330972ba3a4f13 to your computer and use it in GitHub Desktop.
Course format core-context-menu-item example
<?php
namespace format_oustudyplan\output;
defined('MOODLE_INTERNAL') || die();
class mobile {
public static function mobile_course_view($args) {
global $OUTPUT;
$html = $OUTPUT->render_from_template('format_example/mobile');
return [
'templates' => [
[
'id' => 'main',
'html' => $html
]
]
];
}
}
<?php
defined('MOODLE_INTERNAL') || die();
$addons = [
'format_example' => [ // Plugin identifier.
'handlers' => [ // Different places where the plugin will display content.
'example' => [ // Handler unique name (alphanumeric).
'delegate' => 'CoreCourseFormatDelegate', // Delegate (where to display the link to the plugin)
'method' => 'mobile_course_view', // Main function in \format_oustudyplan\output\mobile.
]
]
]
];
{{=<% %>=}}
<core-navbar-buttons>
<core-context-menu>
<core-context-menu-item [priority]="900" content="link" iconAction="open" autoLogin="no" href="http://example.com">
</core-context-menu-item>
</core-context-menu>
</core-navbar-buttons>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment