10 defined(
'JPATH_PLATFORM') or die;
29 protected $type =
'PredefinedList';
37 protected static $options = array();
45 protected $predefinedOptions = array();
53 protected $translate =
true;
62 protected function getOptions()
65 $hash = md5($this->element);
66 $type = strtolower($this->type);
68 if (!isset(static::$options[$type][$hash]) && !empty($this->predefinedOptions))
70 static::$options[$type][$hash] = parent::getOptions();
75 $filter = isset($this->element[
'filter']) ? explode(
',', $this->element[
'filter']) : array();
77 foreach ($this->predefinedOptions as $value => $text)
79 if (empty($filter) || in_array($value, $filter))
81 $text = $this->translate ?
JText::_($text) : $text;
83 $options[] = (object) array(
90 static::$options[$type][$hash] = array_merge(static::$options[$type][$hash], $options);
93 return static::$options[$type][$hash];