/** * Render the inplace editable used to edit the tour enable state. * * @param tour $tour The tour to edit. * @return string */ public static function render_tourenabled_inplace_editable(tour $tour) { global $OUTPUT; if ($tour->is_enabled()) { $icon = 't/hide'; $alt = get_string('disable'); $value = 1; } else { $icon = 't/show'; $alt = get_string('enable'); $value = 0; } $editable = new \core\output\inplace_editable('tool_usertours', 'tourenabled', $tour->get_id(), true, $OUTPUT->pix_icon($icon, $alt, 'moodle', ['title' => $alt]), $value); $editable->set_type_toggle(); return $editable; }