protected function _html() { $tags = self::getTagsList(); foreach (array_keys(array_diff_key($this->options, $tags)) as $tag) { if ($tag == 'default') { continue; } $tags[$tag] = array('caption' => '~' . $tag, 'group' => __('Inactive', $this->domain)); } $options = array('' => __('Select condition...', $this->domain)); $groups = array(); foreach ($tags as $tag => $data) { $options[$tag] = $data['caption']; $groups[$data['group']][] = $tag; } $html = HTML::div()->class($this->getCSSClass(__CLASS__))->data('name', $this->input_name); $ul = $html->addNew('ul')->class('conditions'); $ul->addNew('li')->class('default')->addNew('div')->add($this->options['default']->html()); foreach ($groups as $group_tags) { foreach ($group_tags as $tag) { if (!isset($this->options[$tag])) { continue; } $ul->addNew('li')->add(HTML::a()->class('button delete')->add(__('Delete', $this->domain)), HTML::label()->add(sprintf(__('On %s', $this->domain), '<span>' . $tags[$tag]['caption'] . '</span>' . HTML::makeSelect(null, $tag, $options, $groups)->style('display: none;')->html()), ':'), HTML::div()->add($this->options[$tag]->html())); } } $html->addNew('div')->class('controls')->addNew('a')->class('button customize')->add(__('Customize on...', $this->domain)); $html->addNew('div')->class('prototype')->add(HTML::a()->class('button delete')->style('display: none;')->add(__('Delete', $this->domain)), HTML::label()->add(sprintf(__('On %s', $this->domain), '<span style="display: none;"></span>' . HTML::makeSelect(null, '', $options, $groups)->html()), ':'), HTML::div()->add($this->prototype->html())); return $html; }