function fetchElement($name, $value, &$node, $control_name) { $frontend = $this->def($node->attributes('frontend'), 1); $admin = $this->def($node->attributes('admin'), 1); $show_content = $this->def($node->attributes('show_content'), 0); $components = JElementComponents::getComponents($frontend, $admin, $show_content); // place a dummy hidden checkbox item in the list, to be able to deselect all (and still have a default) $list = "\n" . '<input type="hidden" id="' . $control_name . $name . 'x" name="' . $control_name . '[' . $name . ']' . '[]" value="x" checked="checked" />'; if (count($components)) { foreach ($components as $component) { if (!is_array($value)) { $value = explode(',', $value); } $checked = in_array($component->option, $value) ? ' checked="checked"' : ''; $list .= "\n" . '<input type="checkbox" id="' . $control_name . $name . $component->option . '" name="' . $control_name . '[' . $name . ']' . '[]" value="' . $component->option . '"' . $checked . ' />'; $list .= $component->name . '<br />'; } } else { $list .= JText::_('Component Not Found'); } return $list; }
function getComponentsArray($frontend = 1, $admin = 1, $show_content = 0) { $components = JElementComponents::getComponents($frontend, $admin, $show_content); $components = array(); foreach ($components as $component) { $components[] = $component->option; } return $components; }