|
|
@ -124,6 +124,11 @@ class Tabs extends Widget |
|
|
|
{ |
|
|
|
{ |
|
|
|
$headers = []; |
|
|
|
$headers = []; |
|
|
|
$panes = []; |
|
|
|
$panes = []; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!$this->hasActiveTab() && !empty($this->items)) { |
|
|
|
|
|
|
|
$this->items[0]['active'] = true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
foreach ($this->items as $n => $item) { |
|
|
|
foreach ($this->items as $n => $item) { |
|
|
|
if (!isset($item['label'])) { |
|
|
|
if (!isset($item['label'])) { |
|
|
|
throw new InvalidConfigException("The 'label' option is required."); |
|
|
|
throw new InvalidConfigException("The 'label' option is required."); |
|
|
@ -168,6 +173,19 @@ class Tabs extends Widget |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
|
|
|
|
* @return boolean if there's active tab defined |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
protected function hasActiveTab() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
foreach ($this->items as $item) { |
|
|
|
|
|
|
|
if (isset($item['active']) && $item['active']===true) { |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* Normalizes dropdown item options by removing tab specific keys `content` and `contentOptions`, and also |
|
|
|
* Normalizes dropdown item options by removing tab specific keys `content` and `contentOptions`, and also |
|
|
|
* configure `panes` accordingly. |
|
|
|
* configure `panes` accordingly. |
|
|
|
* @param array $items the dropdown items configuration. |
|
|
|
* @param array $items the dropdown items configuration. |
|
|
|