Skip to content
Snippets Groups Projects
Commit e41a2932 authored by Yorick Reum's avatar Yorick Reum
Browse files

autocompletion for categoriestrigger

parent ff64ae54
Branches
Tags
No related merge requests found
...@@ -67,7 +67,11 @@ class settings_manager { ...@@ -67,7 +67,11 @@ class settings_manager {
$value = $value['text']; $value = $value['text'];
} }
if (is_array($value)) { if (is_array($value)) {
$cleanedvalue = clean_param_array($value, $setting->paramtype); // Not sure if this is best practice...
$cleanedvalue = implode(
',',
clean_param_array($value, $setting->paramtype)
);
} else { } else {
$cleanedvalue = clean_param($value, $setting->paramtype); $cleanedvalue = clean_param($value, $setting->paramtype);
} }
......
...@@ -25,5 +25,6 @@ ...@@ -25,5 +25,6 @@
$string['pluginname'] = 'Categories trigger'; $string['pluginname'] = 'Categories trigger';
$string['categories'] = 'IDs of categories for which the workflow should be triggered'; $string['categories'] = 'Categories, for which the workflow should be triggered';
$string['categories_noselection'] = 'Please choose at least one category.';
$string['exclude'] = 'If ticked, the named categories are excluded from triggering instead.'; $string['exclude'] = 'If ticked, the named categories are excluded from triggering instead.';
...@@ -81,7 +81,7 @@ class categories extends base_automatic { ...@@ -81,7 +81,7 @@ class categories extends base_automatic {
public function instance_settings() { public function instance_settings() {
return array( return array(
new instance_setting('categories', PARAM_INT), new instance_setting('categories', PARAM_SEQUENCE),
new instance_setting('exclude', PARAM_BOOL), new instance_setting('exclude', PARAM_BOOL),
); );
} }
...@@ -95,10 +95,10 @@ class categories extends base_automatic { ...@@ -95,10 +95,10 @@ class categories extends base_automatic {
} }
$options = array( $options = array(
'multiple' => true, 'multiple' => true,
'noselectionstring' => 'lol lol lol', 'noselectionstring' => get_string('categories_noselection', 'lifecycletrigger_categories'),
); );
$mform->addElement('autocomplete', 'categories', get_string('categories', 'lifecycletrigger_categories'), $categorynames, $options); $mform->addElement('autocomplete', 'categories', get_string('categories', 'lifecycletrigger_categories'), $categorynames, $options);
// $mform->setType('categories', PARAM_INT); $mform->setType('categories', PARAM_SEQUENCE);
$mform->addElement('advcheckbox', 'exclude', get_string('exclude', 'lifecycletrigger_categories')); $mform->addElement('advcheckbox', 'exclude', get_string('exclude', 'lifecycletrigger_categories'));
$mform->setType('exclude', PARAM_BOOL); $mform->setType('exclude', PARAM_BOOL);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment