applicable_formats 仅针对用户 'My home'

applicable_formats for only the user 'My home'

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'
),
);

我从积木教程中复制了 access.php,只是更改了名称

更新 - 它应该只是 'my' 而不是 'my-index'。

同样为了完整起见,您可能需要添加 all = false

public function applicable_formats() {
    return array('all' => false, my' => true);
}