为了账号安全,请及时绑定邮箱和手机立即绑定

当添加自定义块的心情显示[[pluginname]]

当添加自定义块的心情显示[[pluginname]]

PHP
翻阅古今 2021-05-07 16:08:38
我正在为穆迪创建自定义块,当我尝试将其添加到页面时,如下所示:而不是指定的名称。该version.php文件具有以下内容:$plugin->component = 'block_userlist';$plugin->version = 2019050316;$plugin->requires = 2018120300;并且该块定义为:defined('MOODLE_INTERNAL') || die();class block_userlist extends block_base {    public function init() {        $this->title = get_string('userlist', 'block_userlist');    }    // The PHP tag and the curly bracket for the class definition     // will only be closed after there is another function added in the next section.    public function get_content() {        global $DB;        // if ($this->content !== null) {        //   return $this->content;        // }        $user = $DB->get_record_sql('SELECT COUNT(*) as total_users FROM {user};');        $this->content         =  new stdClass;        $this->content->text  .= 'The content of our ';        $this->content->text  .= html_writer::tag('span','UserList',['style'=>'color:red']);        $this->content->text  .= ' block!';        $this->content->footer = "Τotal Users: $user->total_users";        return $this->content;    }}那么我该如何设置一个不同于的名称[[pluginame]]呢?
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 170 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信