Пример #1
0
 /**
  * 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);
 }