/** * Here we should render a beginning html of the tab. * * @since 1.0.0 * @return void */ public function beforeRendering() { $isFirstTab = true; $tabClass = $this->getOption('class'); if (!empty($tabClass)) { $this->addCssClass($tabClass); } $this->addCssClass('factory-align-' . $this->align); ?> <div <?php $this->attrs(); ?> > <div class="factory-headers"> <ul class="nav nav-tabs"> <?php foreach ($this->elements as $element) { if ($element->options['type'] !== 'tab-item') { continue; } $hasIcon = isset($element->options['icon']); if ($hasIcon) { $tabIcon = $element->options['icon']; } $builder = new FactoryForms328_HtmlAttributeBuilder(); $builder->addCssClass('factory-tab-item-header'); $builder->addCssClass('factory-tab-item-header-' . $element->getName()); if ($hasIcon) { $builder->addCssClass('factory-tab-item-header-with-icon'); } if ($isFirstTab) { $builder->addCssClass('active'); } $builder->addHtmlData('tab-id', $element->getName()); $isFirstTab = false; if ($hasIcon) { ?> <style> .factory-form-tab-item-header-<?php $element->name(); ?> a { background-image: url("<?php echo $tabIcon; ?> "); } </style> <?php } ?> <li <?php $builder->printAttrs(); ?> > <a href="#<?php $element->name(); ?> " data-toggle="tab"> <?php $element->title(); ?> </a> </li> <?php } ?> </ul> </div> <div class='tab-content factory-bodies'> <?php }
/** * Prints all html attributes, including css classes and data. * * @since 1.0.0 * @return void */ protected function attrs() { return $this->htmlBuilder->printAttrs(); }
/** * Here we should render a beginning html of the tab. * * @since 1.0.0 * @return void */ public function beforeRendering() { $name = $this->getNameOnForm(); $value = $this->getValue(); $title = $this->getOption('title', null); ?> <div <?php $this->attrs(); ?> > <input type="hidden" name="<?php echo $name; ?> " id="<?php echo $name; ?> " class="factory-ui-control-group" value="<?php echo $value; ?> " /> <?php if ($title) { ?> <strong class="factory-header"><?php echo $title; ?> </strong> <?php } ?> <ul class="factory-control-group-nav"> <?php foreach ($this->elements as $element) { if ($element->options['type'] !== 'control-group-item') { continue; } $builder = new FactoryForms328_HtmlAttributeBuilder(); $builder->addCssClass('factory-control-group-nav-label'); $builder->addCssClass('factory-control-group-nav-label-' . $element->getOption('name')); $builder->addHtmlData('control-id', 'factory-control-group-item-' . $element->getOption('name')); $builder->addHtmlData('control-name', $element->getOption('name')); if ($value == $element->getOption('name')) { $builder->addCssClass('current'); } ?> <li <?php $builder->printAttrs(); ?> ><?php $element->title(); ?> </li> <?php } ?> </ul> <div class="factory-control-group-body"> <?php }