开发者

How do I get a Moodle module to *not* allow placement as an activity?

开发者 https://www.devze.com 2023-02-25 02:04 出处:网络
I\'m building a Moodle (2.0) module that interacts with a third-party web service. The module has no UI except for the settings screen. Because the mod开发者_如何学Goule doesn\'t have a UI, it doesn\

I'm building a Moodle (2.0) module that interacts with a third-party web service.

The module has no UI except for the settings screen. Because the mod开发者_如何学Goule doesn't have a UI, it doesn't make sense for a user to be able to place it on the home screen or in a course as an activity. How do I prevent that? How do I keep it from appearing in the Add an activity... list?


I don't believe there is a way to do that within the API (ie - there is no function you can add to your lib.php file to prevent it from appearing in the menu). If you want to apply a dirty hack the function you would probably want to look at is print_section_add_menus in course/lib.php, but I don't recommend that kind of solution.

There is a way to restrict modules in courses through administration settings under the Site Administration -> Security -> Module Security, but that only restricts teachers from adding the activity, not administrators.

All that being said, I would think about reevaluating whether or not your plugin needs to be an activity module. Maybe it would be better off as a local/ plugin or a block.

0

精彩评论

暂无评论...
验证码 换一张
取 消