src/Magento/Helpers/FormMapper.php
public function field($parent, array $field)
    {
        if (!isset($field['attributes'])) {
            $field['attributes'] = array();
        }
        $magentoType = $this->getMagentoType($field);
        $magentoElementSettings = $this->getMagentoElementSettings($field);
        $element = $parent->addField($field['id'], $magentoType, $magentoElementSettings);

        if ($magentoType === 'multiselect') {
            if (!empty($magentoElementSettings['size'])) {
                /** @noinspection PhpUndefinedMethodInspection */
                $element->setSize($magentoElementSettings['size']);
            }
        }

        if (!empty($field['fields'])) {
            // Add description at the start of the fieldset/summary as a note
            // element.
            if (isset($field['description'])) {
                $element->addField($field['id'] . '-note', 'note', array('text' => '<p class="note">' . $field['description'] . '</p>'));
            }

            // Add fields of fieldset.
            $this->fields($element, $field['fields']);
        }
    }
public function field($parent, array $field)
    {
        if (!isset($field['attributes'])) {
            $field['attributes'] = array();
        }
        $magentoType = $this->getMagentoType($field);
        $magentoElementSettings = $this->getMagentoElementSettings($field);
        $element = $parent->addField($field['id'], $magentoType, $magentoElementSettings);

        if ($magentoType === 'multiselect') {
            if (!empty($magentoElementSettings['size'])) {
                /** @noinspection PhpUndefinedMethodInspection */
                $element->setSize($magentoElementSettings['size']);
            }
        }

        if (!empty($field['fields'])) {
            // Add description at the start of the fieldset/summary as a note
            // element.
            if (isset($field['description'])) {
                $element->addField($field['id'] . '-note', 'note', array('text' => '<p class="note">' . $field['description'] . '</p>'));
            }

            // Add fields of fieldset.
            $this->fields($element, $field['fields']);
        }
    }
public function field ( $ parent , array $ field ) { if ( ! isset ( $ field [ 'attributes' ] ) ) { $ field [ 'attributes' ] = array ( ) ; } $ magentoType = $ this -> getMagentoType ( $ field ) ; $ magentoElementSettings = $ this -> getMagentoElementSettings ( $ field ) ; $ element = $ parent -> addField ( $ field [ 'id' ] , $ magentoType , $ magentoElementSettings ) ; if ( $ magentoType === 'multiselect' ) { if ( ! empty ( $ magentoElementSettings [ 'size' ] ) ) { /** @noinspection PhpUndefinedMethodInspection */ $ element -> setSize ( $ magentoElementSettings [ 'size' ] ) ; } } if ( ! empty ( $ field [ 'fields' ] ) ) { // Add description at the start of the fieldset/summary as a note // element. if ( isset ( $ field [ 'description' ] ) ) { $ element -> addField ( $ field [ 'id' ] . '-note' , 'note' , array ( 'text' => '<p class="note">' . $ field [ 'description' ] . '</p>' ) ) ; } // Add fields of fieldset. $ this -> fields ( $ element , $ field [ 'fields' ] ) ; } }
Maps a single field definition.

@param \Varien_Data_Form_Abstract|\Magento\Framework\Data\Form\AbstractForm $parent
@param array $field
Maps a single field definition .