src/PrestaShop/Helpers/FormMapper.php
protected function element(array $field)
    {
        $result = array(
            'type' => $this->getPrestaShopType($field['type']),
            'label' => isset($field['label']) ? $field['label'] : '',
            'name' => $field['name'],
            'required' => isset($field['attributes']['required']) ? $field['attributes']['required'] : false,
            'multiple' => isset($field['attributes']['multiple']) ? $field['attributes']['multiple'] : false,
        );

        if (!empty($field['attributes'])) {
            $result['attributes'] = $field['attributes'];
        }
        if (isset($field['description'])) {
            $result['desc'] = $field['description'];
        }

        if ($field['type'] === 'radio') {
            $result['values'] = $this->getPrestaShopValues($field['name'], $field['options']);
        } elseif ($field['type'] === 'checkbox') {
            $result['values'] = $this->getPrestaShopOptions($field['options']);
        } elseif ($field['type'] === 'select') {
            $result['options'] = $this->getPrestaShopOptions($field['options']);
            if ($result['multiple']) {
                $result['size'] = $field['attributes']['size'];
            }
        }

        return $result;
    }
protected function element(array $field)
    {
        $result = array(
            'type' => $this->getPrestaShopType($field['type']),
            'label' => isset($field['label']) ? $field['label'] : '',
            'name' => $field['name'],
            'required' => isset($field['attributes']['required']) ? $field['attributes']['required'] : false,
            'multiple' => isset($field['attributes']['multiple']) ? $field['attributes']['multiple'] : false,
        );

        if (!empty($field['attributes'])) {
            $result['attributes'] = $field['attributes'];
        }
        if (isset($field['description'])) {
            $result['desc'] = $field['description'];
        }

        if ($field['type'] === 'radio') {
            $result['values'] = $this->getPrestaShopValues($field['name'], $field['options']);
        } elseif ($field['type'] === 'checkbox') {
            $result['values'] = $this->getPrestaShopOptions($field['options']);
        } elseif ($field['type'] === 'select') {
            $result['options'] = $this->getPrestaShopOptions($field['options']);
            if ($result['multiple']) {
                $result['size'] = $field['attributes']['size'];
            }
        }

        return $result;
    }
protected function element ( array $ field ) { $ result = array ( 'type' => $ this -> getPrestaShopType ( $ field [ 'type' ] ) , 'label' => isset ( $ field [ 'label' ] ) ? $ field [ 'label' ] : '' , 'name' => $ field [ 'name' ] , 'required' => isset ( $ field [ 'attributes' ] [ 'required' ] ) ? $ field [ 'attributes' ] [ 'required' ] : false , 'multiple' => isset ( $ field [ 'attributes' ] [ 'multiple' ] ) ? $ field [ 'attributes' ] [ 'multiple' ] : false , ) ; if ( ! empty ( $ field [ 'attributes' ] ) ) { $ result [ 'attributes' ] = $ field [ 'attributes' ] ; } if ( isset ( $ field [ 'description' ] ) ) { $ result [ 'desc' ] = $ field [ 'description' ] ; } if ( $ field [ 'type' ] === 'radio' ) { $ result [ 'values' ] = $ this -> getPrestaShopValues ( $ field [ 'name' ] , $ field [ 'options' ] ) ; } elseif ( $ field [ 'type' ] === 'checkbox' ) { $ result [ 'values' ] = $ this -> getPrestaShopOptions ( $ field [ 'options' ] ) ; } elseif ( $ field [ 'type' ] === 'select' ) { $ result [ 'options' ] = $ this -> getPrestaShopOptions ( $ field [ 'options' ] ) ; if ( $ result [ 'multiple' ] ) { $ result [ 'size' ] = $ field [ 'attributes' ] [ 'size' ] ; } } return $ result ; }
Returns a mapped simple element.

@param array $field

@return array
Returns a mapped simple element .