MDL-51802 core: new template for quick editing a title

convert editing tag name to use new template
This commit is contained in:
Marina Glancy 2016-01-18 15:18:14 +08:00
parent 2f45a11ac4
commit cdc5f9785b
23 changed files with 636 additions and 171 deletions

View file

@ -40,3 +40,20 @@ function tag_page_type_list($pagetype, $parentcontext, $currentcontext) {
'tag-manage'=>get_string('page-tag-manage', 'tag')
);
}
/**
* Implements callback inplace_editable() allowing to edit values in-place
*
* @param string $itemtype
* @param int $itemid
* @param mixed $newvalue
* @return \core\output\inplace_editable
*/
function core_tag_inplace_editable($itemtype, $itemid, $newvalue) {
if ($itemtype === 'tagname') {
require_capability('moodle/tag:manage', context_system::instance());
$tag = core_tag_tag::get($itemid, '*', MUST_EXIST);
$tag->update(array('rawname' => $newvalue));
return new \core_tag\output\tagname($tag);
}
}