| | |
| | | $selected = ($i === 0) ? 'true' : 'false'; |
| | | $hidden = $tab->isHidden() ? ' hidden' : ''; |
| | | |
| | | $header .= '<button type="button" class="button tab' . $active . '" data-tab="' . $slug . '" role="tab" aria-selected="' . $selected . '"' . $hidden . '> |
| | | <h2 class="row">'; |
| | | $header .= sprintf( |
| | | '<button type="button" class="button tab%s" data-tab="%s" role="tab" aria-selected="%s"%s>', |
| | | $active, |
| | | $slug, |
| | | $selected, |
| | | $hidden |
| | | ); |
| | | |
| | | if ($tab->getIcon()) { |
| | | $header .= jvbIcon($tab->getIcon()); |
| | | } |
| | | |
| | | $header .= $tab->getTitle() . '</h2> |
| | | </button>'; |
| | | $header .= sprintf('%s |
| | | </button>', |
| | | $tab->getTitle() |
| | | ); |
| | | |
| | | // Content |
| | | $ariaHidden = ($i === 0) ? 'false' : 'true'; |
| | | $content .= '<div class="tab-content' . $active . '" data-tab="' . $slug . '" role="tabpanel" aria-hidden="' . $ariaHidden . '"'; |
| | | $content .= sprintf( |
| | | '<div class="tab-content%s" data-tab="%s" role="tabpanel" aria-hidden="%s"', |
| | | $active, |
| | | $slug, |
| | | $ariaHidden |
| | | ); |
| | | |
| | | if ($i !== 0) { |
| | | $content .= ' hidden'; |
| | | } |
| | | |
| | | $content .= '> |
| | | <h2>' . $tab->getTitle() . '</h2>'; |
| | | $content .= sprintf('> |
| | | <h2>%s</h2>', |
| | | $tab->getTitle(), |
| | | ); |
| | | |
| | | // Description |
| | | if ($tab->getDescription()) { |
| | | $description = $tab->getDescription(); |
| | | if (!is_array($description)) { |
| | | $content .= apply_filters('the_content', $description); |
| | | $content .= jvb_filter_content( $description); |
| | | } else { |
| | | $content .= implode('', array_map(function ($paragraph) { |
| | | return apply_filters('the_content', $paragraph); |
| | | return jvb_filter_content( $paragraph); |
| | | }, $description)); |
| | | } |
| | | } |
| | | |
| | | $content .= $tab->getContent() . ' |
| | | </div>'; |
| | | $content .= sprintf('%s |
| | | </div>', |
| | | $tab->getContent()); |
| | | $i++; |
| | | } |
| | | |