identifier = rand(1000, 9000); } public function startTab($title, $selected = false, $attributes = '', $clickable = true) { if ($this->opened) $this->endTab(); $this->opened = true; $attributes .= $clickable ? '' : 'data-empty="true"'; $attributes .= $selected ? 'data-selected="true"' : ''; $classLi = $clickable ? '' : 'tabs-title-empty'; $this->identifier = preg_replace('#[^a-z0-9]#is', '_', strtolower((string)$title)); $this->titles[] = '
  • '.$title.'
  • '; ob_start(); return $this->identifier; } public function endTab() { if (!$this->opened) return; $this->opened = false; $this->content[] = '
    '.ob_get_clean().'
    '; $this->tabNumber++; } public function addElementInBar($element, $identifier = '') { $this->inBarElements[] = [ 'element' => $element, 'identifier' => $identifier, ]; } public function display($id) { if ($this->opened) { $this->endTab(); } $tabSystem = ''; $tabSystem .= '
    '; $tabSystem .= implode('', $this->content); $tabSystem .= '
    '; echo $tabSystem; } }