src/TwbBundle/View/Helper/TwbBundleDropdown.php
public function render(array $aDropdownOptions)
    {
        // Dropdown container attributes
        if (empty($aDropdownOptions['attributes'])) {

            $aDropdownOptions['attributes'] = array('class' => 'dropdown');
        } else {
            if (!is_array($aDropdownOptions['attributes'])) {
                throw new LogicException('"attributes" option expects an array, "' . gettype($aDropdownOptions['attributes']) . '" given');
            }

            if (empty($aDropdownOptions['attributes']['class'])) {

                $aDropdownOptions['attributes']['class'] = 'dropdown';
            } elseif (!preg_match('/(\s|^)dropdown(\s|$)/', $aDropdownOptions['attributes']['class'])) {

                $aDropdownOptions['attributes']['class'] .= ' dropdown';
            }
        }

        // Render dropdown
        return sprintf(
                static::$dropdownContainerFormat, $this->createAttributesString($aDropdownOptions['attributes']), //Container attributes
                $this->renderToggle($aDropdownOptions) . //Toggle
                $this->renderListItems($aDropdownOptions) //List items
        );
    }
public function render(array $aDropdownOptions)
    {
        // Dropdown container attributes
        if (empty($aDropdownOptions['attributes'])) {

            $aDropdownOptions['attributes'] = array('class' => 'dropdown');
        } else {
            if (!is_array($aDropdownOptions['attributes'])) {
                throw new LogicException('"attributes" option expects an array, "' . gettype($aDropdownOptions['attributes']) . '" given');
            }

            if (empty($aDropdownOptions['attributes']['class'])) {

                $aDropdownOptions['attributes']['class'] = 'dropdown';
            } elseif (!preg_match('/(\s|^)dropdown(\s|$)/', $aDropdownOptions['attributes']['class'])) {

                $aDropdownOptions['attributes']['class'] .= ' dropdown';
            }
        }

        // Render dropdown
        return sprintf(
                static::$dropdownContainerFormat, $this->createAttributesString($aDropdownOptions['attributes']), //Container attributes
                $this->renderToggle($aDropdownOptions) . //Toggle
                $this->renderListItems($aDropdownOptions) //List items
        );
    }
public function render ( array $ aDropdownOptions ) { // Dropdown container attributes
 if ( empty ( $ aDropdownOptions [ 'attributes' ] ) ) { $ aDropdownOptions [ 'attributes' ] = array ( 'class' => 'dropdown' ) ; } else { if ( ! is_array ( $ aDropdownOptions [ 'attributes' ] ) ) { throw new LogicException ( '"attributes" option expects an array, "' . gettype ( $ aDropdownOptions [ 'attributes' ] ) . '" given' ) ; } if ( empty ( $ aDropdownOptions [ 'attributes' ] [ 'class' ] ) ) { $ aDropdownOptions [ 'attributes' ] [ 'class' ] = 'dropdown' ; } elseif ( ! preg_match ( '/(\s|^)dropdown(\s|$)/' , $ aDropdownOptions [ 'attributes' ] [ 'class' ] ) ) { $ aDropdownOptions [ 'attributes' ] [ 'class' ] .= ' dropdown' ; } } // Render dropdown
 return sprintf ( static :: $ dropdownContainerFormat , $ this -> createAttributesString ( $ aDropdownOptions [ 'attributes' ] ) , //Container attributes
 $ this -> renderToggle ( $ aDropdownOptions ) . //Toggle
 $ this -> renderListItems ( $ aDropdownOptions ) //List items
 ) ; }
Render dropdown markup
@param array $aDropdownOptions
@throws LogicException
@return string
Render dropdown markup