![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/mautic.corals.io/vendor/knplabs/knp-menu/src/Knp/Menu/Factory/ |
<?php namespace Knp\Menu\Factory; use Knp\Menu\ItemInterface; /** * core factory extension with the main logic */ class CoreExtension implements ExtensionInterface { public function buildOptions(array $options): array { return \array_merge( [ 'uri' => null, 'label' => null, 'attributes' => [], 'linkAttributes' => [], 'childrenAttributes' => [], 'labelAttributes' => [], 'extras' => [], 'current' => null, 'display' => true, 'displayChildren' => true, ], $options ); } public function buildItem(ItemInterface $item, array $options): void { $item ->setUri($options['uri']) ->setLabel($options['label']) ->setAttributes($options['attributes']) ->setLinkAttributes($options['linkAttributes']) ->setChildrenAttributes($options['childrenAttributes']) ->setLabelAttributes($options['labelAttributes']) ->setCurrent($options['current']) ->setDisplay($options['display']) ->setDisplayChildren($options['displayChildren']) ; $this->buildExtras($item, $options); } /** * Configures the newly created item's extras * Extras are processed one by one in order not to reset values set by other extensions * * @param array<string, array<string, mixed>> $options */ private function buildExtras(ItemInterface $item, array $options): void { if (!empty($options['extras'])) { foreach ($options['extras'] as $key => $value) { $item->setExtra($key, $value); } } } }