/** * @param string $label * @param array $attributes * @param bool $fromFieldset * @return Dropdown */ public static function createDropdown($label, array $attributes = array(), $fromFieldset = false) { $dropdown = new Dropdown(); $dropdown->setLabel($label); static::applyAttributes($dropdown, $attributes, $fromFieldset); return $dropdown; }
/** * Parse dropdown child. * * @param Dropdown|bool $dropdown Current dropdown element. * @param array $button Button definition. * * @return void */ private static function parseDropdownChild($dropdown, $button) { if ($dropdown === false || !$dropdown instanceof Dropdown) { // @codingStandardsIgnoreStart // TODO throw exception? // @codingStandardsIgnoreEnd return; } if ($button['type'] == 'child') { $child = static::createDropdownItem($button['label'], $button['url'], $button['attributes'], true); } else { if ($dropdown->getChildren()) { $child = static::createDropdownDivider(); $dropdown->addChild($child); } $child = static::createDropdownHeader($button['label'], $button['attributes'], true); } $dropdown->addChild($child); }