src/Helpers/FormRenderer.php
protected function renderLabel($text, $id, array $attributes, $wrapLabel, $prefix = '', $postfix = '')
    {
        $output = '';

        // Split attributes over label and wrapper.
        $wrapperAttributes = array();
        if (!empty($attributes['wrapper'])) {
            $wrapperAttributes = $attributes['wrapper'];
            unset($attributes['wrapper']);
        }
        if (!empty($attributes['required'])) {
            $wrapperAttributes['required'] = $attributes['required'];
        }

        // Tag around main labels.
        if ($wrapLabel) {
            $output .= $this->getWrapper('label', $wrapperAttributes);
        }

        // Label.
        $attributes = $this->addLabelAttributes($attributes, $id);
        $postfix .= !empty($attributes['required']) ? $this->requiredMarkup : '';
        $tag = empty($id) ? $this->multiLabelTag : 'label';
        $output .= $this->getOpenTag($tag, $attributes);
        $output .= $prefix . htmlspecialchars($text, $this->htmlSpecialCharsFlag, 'UTF-8') . $postfix;
        $output .= $this->getCloseTag($tag);

        // Tag around labels.
        if ($wrapLabel) {
            $output .= $this->getWrapperEnd('label');
        }
        return $output;
    }
protected function renderLabel($text, $id, array $attributes, $wrapLabel, $prefix = '', $postfix = '')
    {
        $output = '';

        // Split attributes over label and wrapper.
        $wrapperAttributes = array();
        if (!empty($attributes['wrapper'])) {
            $wrapperAttributes = $attributes['wrapper'];
            unset($attributes['wrapper']);
        }
        if (!empty($attributes['required'])) {
            $wrapperAttributes['required'] = $attributes['required'];
        }

        // Tag around main labels.
        if ($wrapLabel) {
            $output .= $this->getWrapper('label', $wrapperAttributes);
        }

        // Label.
        $attributes = $this->addLabelAttributes($attributes, $id);
        $postfix .= !empty($attributes['required']) ? $this->requiredMarkup : '';
        $tag = empty($id) ? $this->multiLabelTag : 'label';
        $output .= $this->getOpenTag($tag, $attributes);
        $output .= $prefix . htmlspecialchars($text, $this->htmlSpecialCharsFlag, 'UTF-8') . $postfix;
        $output .= $this->getCloseTag($tag);

        // Tag around labels.
        if ($wrapLabel) {
            $output .= $this->getWrapperEnd('label');
        }
        return $output;
    }
protected function renderLabel ( $ text , $ id , array $ attributes , $ wrapLabel , $ prefix = '' , $ postfix = '' ) { $ output = '' ; // Split attributes over label and wrapper. $ wrapperAttributes = array ( ) ; if ( ! empty ( $ attributes [ 'wrapper' ] ) ) { $ wrapperAttributes = $ attributes [ 'wrapper' ] ; unset ( $ attributes [ 'wrapper' ] ) ; } if ( ! empty ( $ attributes [ 'required' ] ) ) { $ wrapperAttributes [ 'required' ] = $ attributes [ 'required' ] ; } // Tag around main labels. if ( $ wrapLabel ) { $ output .= $ this -> getWrapper ( 'label' , $ wrapperAttributes ) ; } // Label. $ attributes = $ this -> addLabelAttributes ( $ attributes , $ id ) ; $ postfix .= ! empty ( $ attributes [ 'required' ] ) ? $ this -> requiredMarkup : '' ; $ tag = empty ( $ id ) ? $ this -> multiLabelTag : 'label' ; $ output .= $ this -> getOpenTag ( $ tag , $ attributes ) ; $ output .= $ prefix . htmlspecialchars ( $ text , $ this -> htmlSpecialCharsFlag , 'UTF-8' ) . $ postfix ; $ output .= $ this -> getCloseTag ( $ tag ) ; // Tag around labels. if ( $ wrapLabel ) { $ output .= $ this -> getWrapperEnd ( 'label' ) ; } return $ output ; }
Renders a label.

@param string $text
The label text.
@param string $id
The value of the for attribute. If the empty string, not a label tag
but a span with a class="label" will be rendered.
@param array $attributes
Any additional attributes to render for the label. The array is a keyed
array, the keys being the attribute names, the values being the
value of that attribute. If that value is an array it is rendered as a
joined string of the values separated by a space (e.g. multiple classes).
@param bool $wrapLabel
Whether to wrap this label within the defined label wrapper tag.
@param string $prefix
Prefix to prepend to the label text, may contain html, so don't escape.
Will come from code not users.
@param string $postfix
Postfix to append to the label text, may contain html, so don't escape.
Will come from code not users.

@return string The rendered label.
The rendered label.
Renders a label .