예제 #1
0
 protected function getOptions()
 {
     $options = array();
     foreach ($this->element->children() as $option) {
         if ($option->getName() != 'option') {
             continue;
         }
         $tmp = JHtml::_('select.option', (string) $option['value'], JText::alt(trim((string) $option), preg_replace('/[^a-zA-Z0-9_\\-]/', '_', $this->fieldname)), 'value', 'text', (string) $option['disabled'] == 'true');
         $tmp->class = (string) $option['class'];
         $tmp->onclick = (string) $option['onclick'];
         $options[] = $tmp;
     }
     reset($options);
     $_options = JUDownloadHelper::getTemplateOptions();
     if ($_options) {
         $options = array_merge($options, $_options);
     }
     for ($i = 0, $n = count($options); $i < $n; $i++) {
         if (isset($options[$i]->level) && isset($options[$i]->text)) {
             $options[$i]->text = str_repeat('- ', $options[$i]->level) . $options[$i]->text;
         }
     }
     return $options;
 }