src/Helpers/FormRenderer.php
protected function renderSimpleField(array $field)
    {
        if (!empty($field['ajax'])) {
            $field = $this->addAjax($field);
        }

        $output = '';

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

        if ($field['type'] !== 'hidden') {
            $output .= $this->getWrapper('element');
            // Do not use a <label> with an "id" attribute on the label for a
            // set of radio buttons, a set of checkboxes, or on markup.
            $id = in_array($field['type'], array('radio', 'checkbox', 'markup')) ? '' : $field['id'];
            $output .= $this->renderLabel($field['label'], $id, $labelAttributes, true);
            $output .= $this->getWrapper('inputDescription');
        }
        $output .= $this->renderElement($field);
        if ($field['type'] !== 'hidden') {
            $output .= $this->renderDescription($field['description']);
            $output .= $this->getWrapperEnd('inputDescription');
            $output .= $this->getWrapperEnd('element');
        }
        return $output;
    }
protected function renderSimpleField(array $field)
    {
        if (!empty($field['ajax'])) {
            $field = $this->addAjax($field);
        }

        $output = '';

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

        if ($field['type'] !== 'hidden') {
            $output .= $this->getWrapper('element');
            // Do not use a <label> with an "id" attribute on the label for a
            // set of radio buttons, a set of checkboxes, or on markup.
            $id = in_array($field['type'], array('radio', 'checkbox', 'markup')) ? '' : $field['id'];
            $output .= $this->renderLabel($field['label'], $id, $labelAttributes, true);
            $output .= $this->getWrapper('inputDescription');
        }
        $output .= $this->renderElement($field);
        if ($field['type'] !== 'hidden') {
            $output .= $this->renderDescription($field['description']);
            $output .= $this->getWrapperEnd('inputDescription');
            $output .= $this->getWrapperEnd('element');
        }
        return $output;
    }
protected function renderSimpleField ( array $ field ) { if ( ! empty ( $ field [ 'ajax' ] ) ) { $ field = $ this -> addAjax ( $ field ) ; } $ output = '' ; // Split attributes over label and element. $ attributes = $ field [ 'attributes' ] ; $ labelAttributes = array ( ) ; if ( ! empty ( $ attributes [ 'label' ] ) ) { $ labelAttributes = $ attributes [ 'label' ] ; unset ( $ attributes [ 'label' ] ) ; } if ( ! empty ( $ attributes [ 'required' ] ) ) { $ labelAttributes [ 'required' ] = $ attributes [ 'required' ] ; } $ field [ 'attributes' ] = $ attributes ; if ( $ field [ 'type' ] !== 'hidden' ) { $ output .= $ this -> getWrapper ( 'element' ) ; // Do not use a <label> with an "id" attribute on the label for a // set of radio buttons, a set of checkboxes, or on markup. $ id = in_array ( $ field [ 'type' ] , array ( 'radio' , 'checkbox' , 'markup' ) ) ? '' : $ field [ 'id' ] ; $ output .= $ this -> renderLabel ( $ field [ 'label' ] , $ id , $ labelAttributes , true ) ; $ output .= $ this -> getWrapper ( 'inputDescription' ) ; } $ output .= $ this -> renderElement ( $ field ) ; if ( $ field [ 'type' ] !== 'hidden' ) { $ output .= $ this -> renderDescription ( $ field [ 'description' ] ) ; $ output .= $ this -> getWrapperEnd ( 'inputDescription' ) ; $ output .= $ this -> getWrapperEnd ( 'element' ) ; } return $ output ; }
Renders a form field including its label and description.

@param array $field

@return string
Html for this form field.
Renders a form field including its label and description .