/** * Produce the control for display * @param Theme $theme The theme that will be used to render the template * @return string The output of the template */ public function get(Theme $theme) { $this->vars['terms'] = $this->value; $this->settings['ignore_name'] = true; $this->settings['internal_value'] = true; $this->add_class('tree_control'); $this->get_id(); return parent::get($theme); }
public function get(Theme $theme) { $checkboxes = $this->options; $control = $this; if (!is_array($control->value)) { $control->value = array(); } array_walk($checkboxes, function (&$item, $key) use($control) { $item = array('label' => Utils::htmlspecialchars($item), 'id' => Utils::slugify($control->get_id() . '-' . $key), 'checked' => in_array($key, $control->value) ? 'checked="checked"' : ''); }); $this->vars['checkboxes'] = $checkboxes; $this->settings['ignore_name'] = true; return parent::get($theme); }