예제 #1
0
 /**
  * Creates a DropdownButton.
  *
  * @param  string  $type
  * @param  string  $value
  * @param  array   $list
  * @param  array   $attributes
  * @param  bool    $right
  * @param  bool    $dropup
  * @param  bool    $autoroute
  * @return string
  */
 protected static function show($type, $value, $list, $attributes = array(), $right = false, $dropup = false, $autoroute = true)
 {
     $attributes = Helpers::add_class($attributes, 'btn-group');
     $list_attr = array();
     if ($right) {
         $list_attr['class'] = 'pull-right';
     }
     if ($dropup) {
         $attributes['class'] .= ' dropup';
     }
     $html = '<div' . HTML::attributes($attributes) . '>';
     $html .= Form::button($value, array('class' => $type), true);
     $html .= Navigation::dropdown($list, $list_attr, $autoroute);
     $html .= '</div>';
     return $html;
 }
 /**
  * Outputs the current Dropdown in instance
  *
  * @return string A Dropdown menu
  */
 public function __toString()
 {
     // Base class
     $this->attributes = Helpers::add_class($this->attributes, 'btn-group');
     // Pull right
     $listAttributes = $this->pullRight ? array('class' => 'pull-right') : array();
     // Dropup
     if ($this->dropup) {
         $this->attributes['class'] .= ' dropup';
     }
     $html = '<div' . HTML::attributes($this->attributes) . '>';
     //If split is false make this button dropdown
     $html .= Form::button($this->label, array('class' => $this->type), !$this->split);
     //Add split button if needed
     if ($this->split) {
         $html .= Form::button('', array('class' => $this->type), true);
     }
     $html .= Navigation::dropdown($this->links, $listAttributes, $this->autoroute);
     $html .= '</div>';
     return $html;
 }
예제 #3
0
    public function testDropdownAll()
    {
        $links = Navigation::links(array(array('foo', '#'), array('bar', '#')));
        $dropdown = Navigation::dropdown($links, array('class' => 'bar', 'data-foo' => 'bar'));

        $matcher = $this->createDropdownMatcher('bar');
        $matcher['attributes']['data-foo'] = 'bar';

        $this->assertHTML($matcher, $dropdown);
    }