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']);
        }
    }