Esempio n. 1
0
 function renderInput($values = null, $options = array())
 {
     if (!$this->_isCompatible) {
         return '';
     }
     $tags = array();
     if (!empty($values)) {
         foreach ($values as $v) {
             if (is_object($v)) {
                 $tags[] = $v->tag_id;
             } else {
                 $tags[] = (int) $v;
             }
         }
     }
     if (empty($options['name'])) {
         $options['name'] = 'tags';
     }
     if (empty($options['mode'])) {
         $options['mode'] = 'ajax';
     }
     if (!isset($options['class'])) {
         $options['class'] = 'inputbox span12 small';
     }
     if (!isset($options['multiple'])) {
         $options['multiple'] = true;
     }
     $xmlConf = new SimpleXMLElement('<field name="' . $options['name'] . '" type="tag" mode="' . $options['mode'] . '" label="" class="' . $options['class'] . '" multiple="' . ($options['multiple'] ? 'true' : 'false') . '"></field>');
     JFormHelper::loadFieldClass('tag');
     $jform = new JForm('hikashop');
     $fieldTag = new JFormFieldTag();
     $fieldTag->setForm($jform);
     $fieldTag->setup($xmlConf, $tags);
     return $fieldTag->input;
 }