Hi,
I'm having trouble following the explanation about implementing inplace editing in my plugin.
- What does it mean by itemtype?
- When I try to test the code I have it gives me an "undefined" popup with no message. Debugging information activated also doesn't show anything.
- I tried naming the function mod_telemedia_inplace_editable and telemedia_inplace_editable and no of them seem to be getting called.
This is the code I have:
function telemedia_inplace_editable($itemtype, $itemid, $newvalue) {
var_dump($itemtype);
if ($itemtype === 'name') {
global $DB;
$telemedia_record = $DB->get_record('telemedia', array("id"=>$itemid), '*', MUST_EXIST);
\external_api::validate_context(context_system::instance());
require_capability('mod/telemedia::update', context_system::instance());
$newvalue = clean_param($newvalue, PARAM_NOTAGS);
$telemedia_record->name = $newvalue;
$DB->update_record('telemedia', $telemedia_record);
return new \core\output\inplace_editable('telemedia', 'name', $telemedia_record->id, true,
$telemedia_record->name, $telemedia_record->name, 'New name', 'New value for ' . $telemedia_record->name);
}
return true;
}
Any hints/help are appreciated.
Pedro