示例#1
0
 public function render()
 {
     if (!empty($this->_items)) {
         if ($this->_is_split === TRUE) {
             $dropdown = new Group(Group::BUTTON_GROUP);
             $dropdown->set_attributes($this->_attributes);
             $dropdown->add_class('btn-group');
             $dropdown->add_item($this->button);
             $dropdown->add_item($this->caret);
             $lists = new Lists();
             $lists->set_class('dropdown-menu');
             $lists->add_items($this->_items);
             $dropdown->add_item($lists);
             return $dropdown->render();
         } else {
             if ($this->caret) {
                 $this->button->append_label($this->caret);
             }
             $items[] = $this->button;
             $lists = new Lists();
             $lists->set_class('dropdown-menu');
             $lists->add_items($this->_items);
             $items[] = $lists;
             return (new Tag($this->_tag, implode(PHP_EOL, $items), $this->_attributes))->render();
         }
     }
     return NULL;
 }