MDL-59368 groups: Inplace editing for users groups

This commit is contained in:
Damyon Wiese
2017-07-12 10:07:57 +08:00
parent 350700bf8b
commit 2fa35b8d16
9 changed files with 330 additions and 10 deletions
+21
View File
@@ -193,6 +193,27 @@ class inplace_editable implements templatable, renderable {
return $this;
}
/**
* Sets the element type to be an autocomplete field
*
* @param array $options associative array with dropdown options
* @param array $attributes associative array with attributes for autoselect field. @see AMD module core/form-autocomplete
* @return self
*/
public function set_type_autocomplete($options, $attributes) {
$this->type = 'autocomplete';
$pairedoptions = [];
foreach ($options as $key => $value) {
$pairedoptions[] = [
'key' => $key,
'value' => $value,
];
}
$this->options = json_encode(['options' => $pairedoptions, 'attributes' => $attributes]);
return $this;
}
/**
* Whether the link should contain all of the content or not.
*/