diff --git a/Collapse.php b/Collapse.php index 80b9755..814e4ba 100644 --- a/Collapse.php +++ b/Collapse.php @@ -94,7 +94,7 @@ class Collapse extends Widget $items = []; $index = 0; foreach ($this->items as $item) { - if (!isset($item['label'])) { + if (!array_key_exists('label', $item)) { throw new InvalidConfigException("The 'label' option is required."); } $header = $item['label']; @@ -116,7 +116,7 @@ class Collapse extends Widget */ public function renderItem($header, $item, $index) { - if (isset($item['content'])) { + if (array_key_exists('content', $item)) { $id = $this->options['id'] . '-collapse' . $index; $options = ArrayHelper::getValue($item, 'contentOptions', []); $options['id'] = $id; diff --git a/Dropdown.php b/Dropdown.php index a31ca29..1803ac2 100644 --- a/Dropdown.php +++ b/Dropdown.php @@ -84,7 +84,7 @@ class Dropdown extends Widget $lines[] = $item; continue; } - if (!isset($item['label'])) { + if (!array_key_exists('label', $item)) { throw new InvalidConfigException("The 'label' option is required."); } $encodeLabel = isset($item['encode']) ? $item['encode'] : $this->encodeLabels; diff --git a/Tabs.php b/Tabs.php index 6be4374..78ac278 100644 --- a/Tabs.php +++ b/Tabs.php @@ -142,7 +142,7 @@ class Tabs extends Widget } foreach ($this->items as $n => $item) { - if (!isset($item['label'])) { + if (!array_key_exists('label', $item)) { throw new InvalidConfigException("The 'label' option is required."); } $encodeLabel = isset($item['encode']) ? $item['encode'] : $this->encodeLabels; @@ -216,7 +216,7 @@ class Tabs extends Widget if (is_string($item)) { continue; } - if (!isset($item['content'])) { + if (!array_key_exists('content', $item)) { throw new InvalidConfigException("The 'content' option is required."); }