data = $data; $this->items = $items; } /** * Counts how many items the menu has. * * @return int */ public function count(): int { $htmlItems = $this->data['html-items'] ?? ''; return substr_count( $htmlItems, 'items as $item ) { $dataItems[] = $item->getTemplateData(); } return $this->data + [ 'class' => '', 'label' => '', 'html-tooltip' => '', 'label-class' => '', 'heading-class' => '', 'html-before-portal' => '', 'html-items' => '', 'html-after-portal' => '', 'data-items' => $dataItems, ]; } }