/**
  * Render the supplied GroupedFields object in a Bootstrap tab view.
  *
  * @param GroupedFields $fields
  * @param array $data
  * @param Renderer $renderer
  * @param integer $viewIndex
  * @return string
  */
 protected function renderGroups(GroupedFields $fields, array $data, Renderer $renderer, $viewIndex = null)
 {
     static $globalGroupedViewCount = 0;
     $output = '<ul class="nav nav-tabs">';
     foreach ($fields->getGroups() as $index => $group) {
         if (count($group)) {
             $output .= sprintf('<li%s><a href="#details_%d_group_%d" data-toggle="tab">%s</a></li>', 0 === $index ? ' class="active"' : '', $this->view->escapeHtmlAttr(null !== $viewIndex ? $viewIndex : $globalGroupedViewCount), $index, $this->view->escapeHtml($group->getTitle()));
         }
     }
     $output .= '</ul>';
     $output .= '<div class="tab-content">';
     foreach ($fields->getGroups() as $index => $group) {
         if (count($group)) {
             $output .= sprintf('<div class="tab-pane-edit tab-pane fade%s" id="details_%d_group_%d">', 0 === $index ? ' in active' : '', $this->view->escapeHtmlAttr(null !== $viewIndex ? $viewIndex : $globalGroupedViewCount), $index);
             $output .= $this->renderFields($group, $data, $renderer);
             $output .= '</div>';
         }
     }
     $output .= '</div>';
     $globalGroupedViewCount += 1;
     return $output;
 }
Esempio n. 2
0
 /**
  * Render a GroupedFields object using a Bootstrap tab view.
  *
  * @param GroupedFields $groupedFields
  * @param InputFilter $inputFilter
  * @param Renderer $renderer
  * @return string
  */
 public function renderGroupedFields(GroupedFields $groupedFields, InputFilter $inputFilter, Renderer $renderer)
 {
     $output = '<ul class="nav nav-tabs">';
     /* @var $group Group */
     foreach ($groupedFields->getGroups() as $index => $group) {
         if (count($group)) {
             $output .= sprintf('<li%s><a href="#group_%d" data-toggle="tab">%s</a></li>', 0 === $index ? ' class="active"' : '', $index, $this->view->escapeHtml($group->getTitle()));
         }
     }
     $output .= '</ul>';
     $output .= '<div class="tab-content">';
     $fieldPosition = 0;
     foreach ($groupedFields->getGroups() as $index => $group) {
         if (count($group)) {
             $output .= sprintf('<div class="tab-pane-edit tab-pane fade%s" id="group_%d">', 0 === $index ? ' in active' : '', $index);
             $output .= $this->renderFields($group, $inputFilter, $renderer, $fieldPosition);
             $output .= '</div>';
             $fieldPosition += count($group);
         }
     }
     $output .= '</div>';
     return $output;
 }