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;
    }