Renders a fieldset or details form element.

@param array $field

@return string
The rendered fieldset or details form element.
481399
protected function renderFieldset(array $field)
    {
        $output = '';
        $output .= $this->fieldsetBegin($field);
        $output .= $this->renderFields($field['fields']);
        $output .= $this->fieldsetEnd($field);
        return $output;
    }
817935
public function render_field($field)
    {
        /*
        *  Review the data of $field.
        *  This will show what data is available
        */

        /**
         * TODO
         *
         * => Render out icons within the select options
         */


        //echo '<pre>';
        //print_r($field);
        //echo '</pre>';

        if (!is_array($this->dropdownOptions($field)) || empty($this->dropdownOptions($field))) {
            return;
        }

        $output = '';

        $output .= '<select class="c-pricons-dropdown" name="' . $field['name'] . '">';

        if ($field['value'] == "") {
            $output .= '<option class="c-pricons-dropdown__option" value="" selected>Select an icon</option>';
        } else {
            $output .= '<option class="c-pricons-dropdown__option" value="">Select an icon</option>';
        }


        foreach ($this->dropdownOptions($field) as $value => $label) {
            if ($value == $field['value']) {
                $output .= '<option class="c-pricons-dropdown__option" value="' . $value . '" selected>' . $label . '</option>';
            } else {
                $output .= '<option class="c-pricons-dropdown__option" value="' . $value . '">' . $label . '</option>';
            }
        }

        $output .= '</select>';

        echo $output;
    }
26835
protected function input(array $field)
    {
        $output = '';

        // Tag around input element.
        $output .= $this->getWrapper('input');

        $attributes = $field['attributes'];
        $attributes = $this->addAttribute($attributes, 'type', $field['type']);
        $attributes = $this->addAttribute($attributes, 'id', $field['id']);
        $attributes = $this->addAttribute($attributes, 'name', $field['name']);
        $attributes = $this->addAttribute($attributes, 'value', $field['value']);
        $output .= $this->getOpenTag('input', $attributes, true);

        // Tag around input element.
        $output .= $this->getWrapperEnd('input');

        return $output;
    }
1254223
public function render()
    {
        $key = $this->arguments['key'];
        $elementKey = $this->arguments['elementKey'];

        $this->fieldHelper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Helper\\FieldHelper');
        $type = $this->fieldHelper->getFieldType($key, $elementKey);

        return $this->fieldHelper->getElementsWhichUseField($key, $type);
    }
440363
protected function formatField(Field $field)
    {
        $column = $field->column();

        $elementName = $elementClass = $errorKey = [];

        $key = $this->key ?: 'new_'.static::DEFAULT_KEY_NAME;

        if (is_array($column)) {
            foreach ($column as $k => $name) {
                $errorKey[$k] = sprintf('%s.%s.%s', $this->relationName, $key, $name);
                $elementName[$k] = sprintf('%s[%s][%s]', $this->relationName, $key, $name);
                $elementClass[$k] = [$this->relationName, $name];
            }
        } else {
            $errorKey = sprintf('%s.%s.%s', $this->relationName, $key, $column);
            $elementName = sprintf('%s[%s][%s]', $this->relationName, $key, $column);
            $elementClass = [$this->relationName, $column];
        }

        return $field->setErrorKey($errorKey)
            ->setElementName($elementName)
            ->setElementClass($elementClass);
    }
1037709
protected function fieldset(array $field)
    {
        $result = array(
            'form' => array(
                'legend' => array(
                    'title' => !empty($field['summary']) ? $field['summary'] : $field['legend'],
                ),
                'input' => $this->fields($field['fields']),
            ),
        );

        // Add description at the start of the fieldset as an html element.
        if (isset($field['description'])) {
            array_unshift($result['form']['input'], array('type' => 'html', 'name' => $field['name'] . '_description', 'html_content' => '<div class="help-block">' . $field['description'] . '</div>'));
        }

        // Add icon to legend.
        if (isset($field['icon'])) {
            $result['form']['legend']['icon'] = $field['icon'];
        }
        return $result;
    }
655674
public function getValFormatted($field)
    {
        $val = $field->valRaw();
        if (\preg_match('|^(\d{3})[\. -]?(\d{2})[\. -]?(\d{4})$|', $val, $matches)) {
            list($area, $group, $serial) = \array_slice($matches, 1);
            return $area.'-'.$group.'-'.$serial;
        }
        return null;
    }
68046
protected function fieldsetBegin(array $field)
    {
        $output = '';
        $output .= $this->getWrapper($field['type'], $field['attributes']);
        $titleTag = $field['type'] === 'fieldset' ? 'legend' : 'summary';
        if (!empty($field[$titleTag])) {
            $output .= $this->getWrapper($titleTag, $field['attributes']);
            $output .= $field[$titleTag];
            $output .= $this->getWrapperEnd($titleTag);
        }
        $output .= $this->getWrapper('fieldsetContent');
        if (!empty($field['description'])) {
            $output .= $this->renderDescription($field['description'], true);
        }
        return $output;
    }
916337
public function render(FileField $field)
	{
		$required = null;

		if($field->hasRule('ch\metanet\formHandler\rule\RequiredRule'))
			$required = ' aria-required="true"';
		
		if($this->numberOfFiles <= 1)
			return '<input type="file" name="' . $field->getFormIdentifierAsString() . '" id="' . $field->getId() . '" ' . $this->getAttributesAsHtml() . $required . '>';
		
		$field->setLinkedLabel(false);
		
		$html = '<ul' . $this->getAttributesAsHtml() . '>';
		
		for($i = 0; $i < $this->numberOfFiles; $i++) {
			$html .= '<li><input type="file" name="' . $field->getFormIdentifierAsString() . '[]" id="' . $field->getId() . '-' . $i . '" ' . ($i === 0 ? $required : null) . '></li>';
		}
		
		$html .= '</ul>';
		
		return $html;
	}
1232545
public function getFieldDescription($field)
    {
        $item = $this->fields->find('Name', $field);

        if (!$item) {
            throw new Exception(
                sprintf(
                    'Tried to get field description for %s, but it has not been added to %s',
                    $field,
                    $this->getDataObjectClass()
                )
            );
        }

        return $item->Description;
    }
1280540
public function render_field($field)
    {
        // convert value to array
        $field['value'] = acf_get_array($field['value'], false);

        // add empty value (allows '' to be selected)
        if (empty($field['value'])) {
            $field['value'][''] = '';
        }

        // placeholder
        if (empty($field['placeholder'])) {
            $field['placeholder'] = __("Select",'acf');
        }

        // vars
        $atts = array(
            'id'                => $field['id'],
            'class'             => $field['class'],
            'name'              => $field['name'],
            'data-multiple'     => $field['multiple'],
            'data-placeholder'  => $field['placeholder'],
            'data-allow_null'   => $field['allow_null']
        );

        // multiple
        if ($field['multiple']) {
            $atts['multiple'] = 'multiple';
            $atts['size'] = 5;
            $atts['name'] .= '[]';
        }

        // special atts
        foreach (array( 'readonly', 'disabled' ) as $k) {
            if (!empty($field[ $k ])) {
                $atts[ $k ] = $k;
            }
        }

        // vars
        $els = array();
        // $choices = array();

        $posttypes = $this->post_type_options();
        foreach ($posttypes as $pt) {
            $els[] = array(
                'type' => 'option',
                'value' => $pt['value'],
                'label' => $pt['label'],
                'selected' => in_array($pt['value'], $field['value'])
            );
        }

        // null
        if ($field['allow_null']) {
            array_unshift($els, array(
                'type' => 'option',
                'value' => '',
                'label' => '- ' . $field['placeholder'] . ' -'
            ));
        }

        // html
        echo '<select ' . acf_esc_attr($atts) . '>';

        // construct html
        if (!empty($els)) {
            foreach ($els as $el) {
                // extract type
                $type = acf_extract_var($el, 'type');
                if ($type == 'option') {
                    // get label
                    $label = acf_extract_var($el, 'label');
                    // validate selected
                    if (acf_extract_var($el, 'selected')) {
                        $el['selected'] = 'selected';
                    }

                    // echo
                    echo '<option ' . acf_esc_attr($el) . '>' . $label . '</option>';
                } else {
                    // echo
                    echo '<' . $type . ' ' . acf_esc_attr($el) . '>';
                }


            }

        }

        echo '</select>';
    }
1006989
private function getSetterName($field)
    {
        $parts = explode('_', $field);
        array_map('ucfirst', $parts);
        $name = 'set' . implode('', $parts);

        return $name;
    }
589401
private function processInput($field)
    {
        $output = '';
        if ($field['div'] == TRUE) $output .= $this->div('open', $field['divId'], $field['divClass'], $field['divAttributes']);
        switch (strtolower($field['type'])) {
            case 'a':
                if ($field['name'] != '' || $field['value'] != '') {
                    $url = sprintf('%s?%s', $field['name'], $field['value']);
                }
                $output .= $this->a('full', $field['id'], $field['class'], $field['attributes'], $url, $field['labelText']);
                break;
            case 'br':
                $output .= $this->br('full', $field['id'], $field['class'], $field['attributes']);
                break;
            case 'divopen':
                $output .= $this->div('open', $field['id'], $field['class'], $field['attributes']);
                break;
            case 'divclose':
                $output .= $this->div('close');
                break;
            case 'span':
                $output .= $this->span('full', $field['id'], $field['class'], $field['attributes'], $field['value']);
                break;
            case 'checkbox':
            case 'radio':
                $output .= $this->input('full', $field['id'], $field['class'], $field['attributes'], $field['type'], $field['name'], $field['value']);
                $output .= $this->label('full', $field['labelId'], $field['labelClass'], $field['labelAttributes'], $field['id'], $field['labelText']);
                break;
            case 'select':
                if ($field['labelText'] != '') {
                    $output .= $this->label('full', $field['labelId'], $field['labelClass'], $field['labelAttributes'], $field['id'], $field['labelText']);
                }
                $output .= $this->select('full', $field['id'], $field['class'], $field['attributes'], $field['name'], $field['value']);
                break;
            case 'textarea':
                if ($field['labelText'] != '') {
                    $output .= $this->label('full', $field['labelId'], $field['labelClass'], $field['labelAttributes'], $field['id'], $field['labelText']);
                    $output .= $this->br('full');
                }
                $output .= $this->textarea('full', $field['id'], $field['class'], $field['attributes'], $field['name'], 0, 0, $field['value']);
                break;
            default:
                if ($field['labelText'] != '') {
                    $output .= $this->label('full', $field['labelId'], $field['labelClass'], $field['labelAttributes'], $field['id'], $field['labelText']);
                }
                if ($field['placeholder'] != '') $this->fixInputAttributes($field);
                $output .= $this->input('full', $field['id'], $field['class'], $field['attributes'], $field['type'], $field['name'], $field['value']);
        }
        if ($field['div'] == TRUE) $output .= $this->div('close');
        return $output;
    }
1313972
public function resolveForField($field)
    {
        if (! is_null($element = $this->findById($field))) {
            return $element;
        }

        return $this->firstOrFail([
            $field, "input[name='{$field}']", "textarea[name='{$field}']",
            "select[name='{$field}']", "button[name='{$field}']",
        ]);
    }
912750
private function getFields($field)
    {
        if ($field instanceof Group || $field instanceof Fieldset) {
            $elements = $field->getFields();
        } elseif ($field instanceof AbstractField) {
            $elements = [$field];
        } else {
            throw new \InvalidArgumentException(sprintf(
                "Invalid type '%s'",
                is_object($field) ? get_class($field) : gettype($field)
            ));
        }

        return $elements;
    }
322572
protected function stringify($fields)
    {
        $string = '';
        foreach ($fields as $var => $val) {
            $string .= $var.': '.$this->lineFormatter->stringify($val)." | ";
        }

        $string = rtrim($string, " |");

        return $string;
    }
1071109
protected function renderElement($field)
    {
        $type = $field['type'];
        switch ($type) {
            case 'textarea':
            case 'markup':
            case 'select':
            case 'radio':
            case 'checkbox':
                return $this->$type($field);
            default:
                return $this->input($field);
        }
    }