/** * Method to get the field input markup. * * @return string The field input markup. */ protected function getInput() { $db = \App::get('db'); $html = array(); $html[] = '<select name="' . $this->name . '" id="' . $this->id . '">'; include_once PATH_CORE . DS . 'components' . DS . 'com_support' . DS . 'tables' . DS . 'message.php'; $sr = new \Components\Support\Tables\Message($db); $messages = $sr->getMessages(); $html[] = '<option value="0"' . (!$this->value ? ' selected="selected"' : '') . '>[ none ]</option>'; foreach ($messages as $anode) { $html[] = '<option value="' . $anode->id . '"' . ($this->value == $anode->id ? ' selected="selected"' : '') . '>' . stripslashes($anode->title) . '</option>'; } $html[] = '</select>'; return implode("\n", $html); }
/** * Fetch the element * * @param string $name Element name * @param string $value Element value * @param object &$node XMLElement node object containing the settings for the element * @param string $control_name Control name * @return string * @since 1.3.1 */ public function fetchElement($name, $value, &$node, $control_name) { $db = \App::get('db'); $html = array(); $html[] = '<select name="' . $control_name . '[' . $name . ']" id="' . $control_name . $name . '">'; include_once PATH_CORE . DS . 'components' . DS . 'com_support' . DS . 'tables' . DS . 'message.php'; $sr = new \Components\Support\Tables\Message($db); $messages = $sr->getMessages(); $html[] = '<option value="0"' . (!$value ? ' selected="selected"' : '') . '>[ none ]</option>'; foreach ($messages as $anode) { $html[] = '<option value="' . $anode->id . '"' . ($value == $anode->id ? ' selected="selected"' : '') . '>' . stripslashes($anode->title) . '</option>'; } $html[] = '</select>'; return implode("\n", $html); }