在applicable_formats()
函数的数组中需要什么,所以它只能在用户的My home
页面上使用?我已经将my-index
设置为true。
acces.php
<?php
$capabilities = array(
'block/groups:myaddinstance' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_SYSTEM,
'archetypes' => array(
'user' => CAP_ALLOW
),
'clonepermissionsfrom' => 'moodle/my:manageblocks'
),
'block/groups:addinstance' => array(
'riskbitmask' => RISK_SPAM | RISK_XSS,
'captype' => 'write',
'contextlevel' => CONTEXT_BLOCK,
'archetypes' => array(
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW
),
'clonepermissionsfrom' => 'moodle/site:manageblocks'
),
);
我从blocks教程中复制了access.php,只更改了名称
UPDATE -应该是" my "而不是" my-index "。
同样为了完整起见,您可能需要添加all = false
public function applicable_formats() {
return array('all' => false, my' => true);
}