本文整理汇总了PHP中assign_plugin::get_config方法的典型用法代码示例。如果您正苦于以下问题:PHP assign_plugin::get_config方法的具体用法?PHP assign_plugin::get_config怎么用?PHP assign_plugin::get_config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类assign_plugin
的用法示例。
在下文中一共展示了assign_plugin::get_config方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add_plugin_settings
/**
* Add one plugins settings to edit plugin form.
*
* @param assign_plugin $plugin The plugin to add the settings from
* @param MoodleQuickForm $mform The form to add the configuration settings to.
* This form is modified directly (not returned).
* @param array $pluginsenabled A list of form elements to be added to a group.
* The new element is added to this array by this function.
* @return void
*/
protected function add_plugin_settings(assign_plugin $plugin, MoodleQuickForm $mform, &$pluginsenabled)
{
global $CFG;
if ($plugin->is_visible() && !$plugin->is_configurable() && $plugin->is_enabled()) {
$name = $plugin->get_subtype() . '_' . $plugin->get_type() . '_enabled';
$pluginsenabled[] = $mform->createElement('hidden', $name, 1);
$mform->setType($name, PARAM_BOOL);
$plugin->get_settings($mform);
} else {
if ($plugin->is_visible() && $plugin->is_configurable()) {
$name = $plugin->get_subtype() . '_' . $plugin->get_type() . '_enabled';
$label = $plugin->get_name();
$label .= ' ' . $this->get_renderer()->help_icon('enabled', $plugin->get_subtype() . '_' . $plugin->get_type());
$pluginsenabled[] = $mform->createElement('checkbox', $name, '', $label);
$default = get_config($plugin->get_subtype() . '_' . $plugin->get_type(), 'default');
if ($plugin->get_config('enabled') !== false) {
$default = $plugin->is_enabled();
}
$mform->setDefault($plugin->get_subtype() . '_' . $plugin->get_type() . '_enabled', $default);
$plugin->get_settings($mform);
}
}
}
示例2: add_plugin_settings
/**
* Add one plugins settings to edit plugin form
*
* @param assign_plugin $plugin The plugin to add the settings from
* @param MoodleQuickForm $mform The form to add the configuration settings to. This form is modified directly (not returned)
* @return void
*/
private function add_plugin_settings(assign_plugin $plugin, MoodleQuickForm $mform) {
global $CFG;
if ($plugin->is_visible()) {
// enabled
//tied disableIf rule to this select element
$mform->addElement('selectyesno', $plugin->get_subtype() . '_' . $plugin->get_type() . '_enabled', $plugin->get_name());
$mform->addHelpButton($plugin->get_subtype() . '_' . $plugin->get_type() . '_enabled', 'enabled', $plugin->get_subtype() . '_' . $plugin->get_type());
$default = get_config($plugin->get_subtype() . '_' . $plugin->get_type(), 'default');
if ($plugin->get_config('enabled') !== false) {
$default = $plugin->is_enabled();
}
$mform->setDefault($plugin->get_subtype() . '_' . $plugin->get_type() . '_enabled', $default);
$plugin->get_settings($mform);
}
}