예제 #1
0
 /**
  * Generate a Bootstrap tabbable object. 
  *
  * @param  array   $list
  * @param  string  $placement
  * @param  string  $menu_type @see Navigation
  * @param  bool    $stacked
  * @param  array   $attributes
  * @param  array   $menu_attributes
  * @param  array   $content_attributes
  * @param  bool    $autoroute
  * @return string
  */
 public static function create($list, $placement = Tabbable::PLACEMENT_ABOVE, $menu_type = Navigation::TYPE_TABS, $stacked = false, $attributes = array(), $menu_attributes = array(), $content_attributes = array(), $autoroute = true)
 {
     $content = array();
     $list = static::normalize($list, $content);
     $tabs = Navigation::menu($list, $menu_type, $stacked, $menu_attributes, $autoroute);
     //Tab content container
     if (!isset($content_attributes['class'])) {
         $content_attributes['class'] = '';
     }
     $content_attributes['class'] .= ' tab-content';
     $content = '<div ' . HTML::attributes($content_attributes) . '>' . implode('', $content) . '</div>';
     $html = '<div class="tabbable ' . $placement . '"' . HTML::attributes($attributes) . '>';
     $html .= $placement === self::PLACEMENT_BELOW ? $content . $tabs : $tabs . $content;
     $html .= '</div>';
     return $html;
 }
예제 #2
0
 /**
  * Writes the current Tabbable
  *
  * @return string A Bootstrap Tabbable
  */
 public function __toString()
 {
     $content = array();
     $list = static::normalize($this->menu, $content);
     $tabs = Navigation::menu($list, $this->style, $this->stacked, $this->menu_attributes, $this->autoroute);
     // Tab content container
     if (!isset($this->content_attributes['class'])) {
         $this->content_attributes['class'] = 'tab-content';
     } else {
         $this->content_attributes['class'] .= ' tab-content';
     }
     $content = '<div ' . HTML::attributes($this->content_attributes) . '>' . implode('', $content) . '</div>';
     $html = '<div class="tabbable ' . $this->placement . '"' . HTML::attributes($this->attributes) . '>';
     $html .= $this->placement === self::PLACEMENT_BELOW ? $content . $tabs : $tabs . $content;
     $html .= '</div>';
     return $html;
 }