向Moodle Mobile 3.5添加新的主菜单项

时间:2018-10-18 13:25:13

标签: moodle moodle-mobile

问候,

我正在尝试开发一个新插件,以便使用PHP和Angular / Ionic 3在Moodle Mobile 3.5中将一个项目添加到主菜单中。我想显示一个新的主菜单项目“ 议程”(带有图标)。

在创建 db \ mobile.php 文件并将委托定义为“ CoreMainMenuDelegate ”之后,现在的问题是在主菜单中将名称显示为“ plugin.local_parentagenda.Agenda ”,并且没有图标。

请咨询!

  • Moodle网站版本:3.3.1
  • Moodle移动版:3.5

enter image description here

1 个答案:

答案 0 :(得分:0)

您必须从displaydata中的lang定义中添加有效的键字符串作为标题,并且图标是来自ionicicons的字符串。搜索ion-md,只有那些有效。
这里有一个示例插件local / example / db / mobile.php

$addons = array(
"local_example" => array( // Plugin identifier
    'handlers' => array( // Different places where the plugin will display content.
        'localexample' => array( // Handler unique name (alphanumeric).
            'displaydata' => array(
                'title' => 'pluginname',
                'icon' => 'bluetooth',
                'class' => '',
            ),

            'delegate' => 'CoreMainMenuDelegate', // Delegate (where to display the link to the plugin)
            'method' => 'mobile_test_view', // Main function in \local_example\output\mobile
        )
    ),
    'lang' => array(    // Language strings that are used in all the handlers.
        array('pluginname', 'local_example'),
        array('example:viewexample', 'local_example')
    ),
));

请注意,displaydata数组中的title属性和lang数组中的pluginname定义都是必需的。