public function renderToggle(array $aDropdownOptions)
    {
        // Dropdown toggle
        if (empty($aDropdownOptions['label'])) {
            $aDropdownOptions['label'] = '';
        } elseif (!is_scalar($aDropdownOptions['label'])) {
            throw new InvalidArgumentException('"label" option expects a scalar value, "' . gettype($aDropdownOptions['label']) . '" given');
        } elseif (($oTranslator = $this->getTranslator())) {
            $aDropdownOptions['label'] = $oTranslator->translate($aDropdownOptions['label'], $this->getTranslatorTextDomain());
        }

        // Dropdown toggle attributes (class)
        if (empty($aDropdownOptions['toggle_attributes'])) {
            $aDropdownOptions['toggle_attributes'] = array('class' => 'sr-only dropdown-toggle');
        } else {
            if (!is_array($aDropdownOptions['toggle_attributes'])) {
                throw new InvalidArgumentException('"toggle_attributes" option expects an array, "' . gettype($aDropdownOptions['toggle_attributes']) . '" given');
            }

            if (empty($aDropdownOptions['toggle_attributes']['class'])) {
                $aDropdownOptions['toggle_attributes']['class'] = 'sr-only dropdown-toggle';
            } else {
                if (!preg_match('/(\s|^)sr-only(\s|$)/', $aDropdownOptions['toggle_attributes']['class'])) {
                    $aDropdownOptions['toggle_attributes']['class'] .= ' sr-only';
                }
                if (!preg_match('/(\s|^)dropdown-toggle(\s|$)/', $aDropdownOptions['toggle_attributes']['class'])) {
                    $aDropdownOptions['toggle_attributes']['class'] .= ' dropdown-toggle';
                }
            }
        }

        // Dropdown toggle attributes (data-toggle)
        if (empty($aDropdownOptions['toggle_attributes']['data-toggle'])) {
            $aDropdownOptions['toggle_attributes']['data-toggle'] = 'dropdown';
        }

        // Dropdown toggle attributes (role)
        if (empty($aDropdownOptions['toggle_attributes']['role'])) {
            $aDropdownOptions['toggle_attributes']['role'] = 'button';
        }

        // Dropdown toggle attributes (href)
        if (empty($aDropdownOptions['toggle_attributes']['href'])) {
            $aDropdownOptions['toggle_attributes']['href'] = '#';
        }

        // Dropdown toggle attributes (id)
        if (!empty($aDropdownOptions['name'])) {
            $aDropdownOptions['toggle_attributes']['id'] = $aDropdownOptions['name'];
        }

        $aValidTagAttributes = $this->validTagAttributes;
        $this->validTagAttributes = array('href' => true);
        $sAttributeString = $this->createAttributesString($aDropdownOptions['toggle_attributes']);
        $this->validTagAttributes = $aValidTagAttributes;

        return sprintf(
                static::$dropdownToggleFormat, $sAttributeString, // Toggle attributes
                $this->getEscapeHtmlHelper()->__invoke($aDropdownOptions['label']) // Toggle label
        );
    }
public function renderToggle(array $aDropdownOptions)
    {
        // Dropdown toggle
        if (empty($aDropdownOptions['label'])) {
            $aDropdownOptions['label'] = '';
        } elseif (!is_scalar($aDropdownOptions['label'])) {
            throw new InvalidArgumentException('"label" option expects a scalar value, "' . gettype($aDropdownOptions['label']) . '" given');
        } elseif (($oTranslator = $this->getTranslator())) {
            $aDropdownOptions['label'] = $oTranslator->translate($aDropdownOptions['label'], $this->getTranslatorTextDomain());
        }

        // Dropdown toggle attributes (class)
        if (empty($aDropdownOptions['toggle_attributes'])) {
            $aDropdownOptions['toggle_attributes'] = array('class' => 'sr-only dropdown-toggle');
        } else {
            if (!is_array($aDropdownOptions['toggle_attributes'])) {
                throw new InvalidArgumentException('"toggle_attributes" option expects an array, "' . gettype($aDropdownOptions['toggle_attributes']) . '" given');
            }

            if (empty($aDropdownOptions['toggle_attributes']['class'])) {
                $aDropdownOptions['toggle_attributes']['class'] = 'sr-only dropdown-toggle';
            } else {
                if (!preg_match('/(\s|^)sr-only(\s|$)/', $aDropdownOptions['toggle_attributes']['class'])) {
                    $aDropdownOptions['toggle_attributes']['class'] .= ' sr-only';
                }
                if (!preg_match('/(\s|^)dropdown-toggle(\s|$)/', $aDropdownOptions['toggle_attributes']['class'])) {
                    $aDropdownOptions['toggle_attributes']['class'] .= ' dropdown-toggle';
                }
            }
        }

        // Dropdown toggle attributes (data-toggle)
        if (empty($aDropdownOptions['toggle_attributes']['data-toggle'])) {
            $aDropdownOptions['toggle_attributes']['data-toggle'] = 'dropdown';
        }

        // Dropdown toggle attributes (role)
        if (empty($aDropdownOptions['toggle_attributes']['role'])) {
            $aDropdownOptions['toggle_attributes']['role'] = 'button';
        }

        // Dropdown toggle attributes (href)
        if (empty($aDropdownOptions['toggle_attributes']['href'])) {
            $aDropdownOptions['toggle_attributes']['href'] = '#';
        }

        // Dropdown toggle attributes (id)
        if (!empty($aDropdownOptions['name'])) {
            $aDropdownOptions['toggle_attributes']['id'] = $aDropdownOptions['name'];
        }

        $aValidTagAttributes = $this->validTagAttributes;
        $this->validTagAttributes = array('href' => true);
        $sAttributeString = $this->createAttributesString($aDropdownOptions['toggle_attributes']);
        $this->validTagAttributes = $aValidTagAttributes;

        return sprintf(
                static::$dropdownToggleFormat, $sAttributeString, // Toggle attributes
                $this->getEscapeHtmlHelper()->__invoke($aDropdownOptions['label']) // Toggle label
        );
    }
public function renderToggle ( array $ aDropdownOptions ) { // Dropdown toggle
 if ( empty ( $ aDropdownOptions [ 'label' ] ) ) { $ aDropdownOptions [ 'label' ] = '' ; } elseif ( ! is_scalar ( $ aDropdownOptions [ 'label' ] ) ) { throw new InvalidArgumentException ( '"label" option expects a scalar value, "' . gettype ( $ aDropdownOptions [ 'label' ] ) . '" given' ) ; } elseif ( ( $ oTranslator = $ this -> getTranslator ( ) ) ) { $ aDropdownOptions [ 'label' ] = $ oTranslator -> translate ( $ aDropdownOptions [ 'label' ] , $ this -> getTranslatorTextDomain ( ) ) ; } // Dropdown toggle attributes (class)
 if ( empty ( $ aDropdownOptions [ 'toggle_attributes' ] ) ) { $ aDropdownOptions [ 'toggle_attributes' ] = array ( 'class' => 'sr-only dropdown-toggle' ) ; } else { if ( ! is_array ( $ aDropdownOptions [ 'toggle_attributes' ] ) ) { throw new InvalidArgumentException ( '"toggle_attributes" option expects an array, "' . gettype ( $ aDropdownOptions [ 'toggle_attributes' ] ) . '" given' ) ; } if ( empty ( $ aDropdownOptions [ 'toggle_attributes' ] [ 'class' ] ) ) { $ aDropdownOptions [ 'toggle_attributes' ] [ 'class' ] = 'sr-only dropdown-toggle' ; } else { if ( ! preg_match ( '/(\s|^)sr-only(\s|$)/' , $ aDropdownOptions [ 'toggle_attributes' ] [ 'class' ] ) ) { $ aDropdownOptions [ 'toggle_attributes' ] [ 'class' ] .= ' sr-only' ; } if ( ! preg_match ( '/(\s|^)dropdown-toggle(\s|$)/' , $ aDropdownOptions [ 'toggle_attributes' ] [ 'class' ] ) ) { $ aDropdownOptions [ 'toggle_attributes' ] [ 'class' ] .= ' dropdown-toggle' ; } } } // Dropdown toggle attributes (data-toggle)
 if ( empty ( $ aDropdownOptions [ 'toggle_attributes' ] [ 'data-toggle' ] ) ) { $ aDropdownOptions [ 'toggle_attributes' ] [ 'data-toggle' ] = 'dropdown' ; } // Dropdown toggle attributes (role)
 if ( empty ( $ aDropdownOptions [ 'toggle_attributes' ] [ 'role' ] ) ) { $ aDropdownOptions [ 'toggle_attributes' ] [ 'role' ] = 'button' ; } // Dropdown toggle attributes (href)
 if ( empty ( $ aDropdownOptions [ 'toggle_attributes' ] [ 'href' ] ) ) { $ aDropdownOptions [ 'toggle_attributes' ] [ 'href' ] = '#' ; } // Dropdown toggle attributes (id)
 if ( ! empty ( $ aDropdownOptions [ 'name' ] ) ) { $ aDropdownOptions [ 'toggle_attributes' ] [ 'id' ] = $ aDropdownOptions [ 'name' ] ; } $ aValidTagAttributes = $ this -> validTagAttributes ; $ this -> validTagAttributes = array ( 'href' => true ) ; $ sAttributeString = $ this -> createAttributesString ( $ aDropdownOptions [ 'toggle_attributes' ] ) ; $ this -> validTagAttributes = $ aValidTagAttributes ; return sprintf ( static :: $ dropdownToggleFormat , $ sAttributeString , // Toggle attributes
 $ this -> getEscapeHtmlHelper ( ) -> __invoke ( $ aDropdownOptions [ 'label' ] ) // Toggle label
 ) ; }
Render dropdown toggle markup
@param array $aDropdownOptions
@throws LogicException
@return string
Render dropdown toggle markup