Renders the field holder for the receiver.

@param array $properties

@return DBHTMLText
8388
public function FieldHolder($properties = [])
    {
        return FieldGroup::create(
            $this->Title(),
            $this->Fields
        )->addExtraClass('dimensions')->FieldHolder($properties);
    }
276408
public function FieldHolder($properties = array())
    {
        $columns = $this->getColumns();

        $list = $this->getManipulatedList();

        $content = array(
            'before' => '',
            'after' => '',
            'header' => '',
            'footer' => '',
        );

        foreach ($this->getComponents() as $item) {
            if ($item instanceof GridField_HTMLProvider) {
                $fragments = $item->getHTMLFragments($this);

                if ($fragments) {
                    foreach ($fragments as $fragmentKey => $fragmentValue) {
                        $fragmentKey = strtolower($fragmentKey);

                        if (!isset($content[$fragmentKey])) {
                            $content[$fragmentKey] = '';
                        }

                        $content[$fragmentKey] .= $fragmentValue . "\n";
                    }
                }
            }
        }

        foreach ($content as $contentKey => $contentValue) {
            $content[$contentKey] = trim($contentValue);
        }

        // Replace custom fragments and check which fragments are defined. Circular dependencies
        // are detected by disallowing any item to be deferred more than 5 times.

        $fragmentDefined = array(
            'header' => true,
            'footer' => true,
            'before' => true,
            'after' => true,
        );
        $fragmentDeferred = [];

        // TODO: Break the below into separate reducer methods

        // Continue looping if any placeholders exist
        while (array_filter($content, function ($value) {
            return preg_match(self::FRAGMENT_REGEX, $value);
        })) {
            foreach ($content as $contentKey => $contentValue) {
                // Skip if this specific content has no placeholders
                if (!preg_match_all(self::FRAGMENT_REGEX, $contentValue, $matches)) {
                    continue;
                }
                foreach ($matches[1] as $match) {
                    $fragmentName = strtolower($match);
                    $fragmentDefined[$fragmentName] = true;

                    $fragment = '';

                    if (isset($content[$fragmentName])) {
                        $fragment = $content[$fragmentName];
                    }

                    // If the fragment still has a fragment definition in it, when we should defer
                    // this item until later.

                    if (preg_match(self::FRAGMENT_REGEX, $fragment, $matches)) {
                        if (isset($fragmentDeferred[$contentKey]) && $fragmentDeferred[$contentKey] > 5) {
                            throw new LogicException(sprintf(
                                'GridField HTML fragment "%s" and "%s" appear to have a circular dependency.',
                                $fragmentName,
                                $matches[1]
                            ));
                        }

                        unset($content[$contentKey]);

                        $content[$contentKey] = $contentValue;

                        if (!isset($fragmentDeferred[$contentKey])) {
                            $fragmentDeferred[$contentKey] = 0;
                        }

                        $fragmentDeferred[$contentKey]++;

                        break;
                    } else {
                        $content[$contentKey] = preg_replace(
                            sprintf('/\$DefineFragment\(%s\)/i', $fragmentName),
                            $fragment,
                            $content[$contentKey]
                        );
                    }
                }
            }
        }

        // Check for any undefined fragments, and if so throw an exception.
        // While we're at it, trim whitespace off the elements.

        foreach ($content as $contentKey => $contentValue) {
            if (empty($fragmentDefined[$contentKey])) {
                throw new LogicException(sprintf(
                    'GridField HTML fragment "%s" was given content, but not defined. Perhaps there is a supporting GridField component you need to add?',
                    $contentKey
                ));
            }
        }

        $total = count($list);

        if ($total > 0) {
            $rows = array();

            foreach ($list as $index => $record) {
                if ($record->hasMethod('canView') && !$record->canView()) {
                    continue;
                }

                $rowContent = '';

                foreach ($this->getColumns() as $column) {
                    $colContent = $this->getColumnContent($record, $column);

                    // Null means this columns should be skipped altogether.

                    if ($colContent === null) {
                        continue;
                    }

                    $colAttributes = $this->getColumnAttributes($record, $column);

                    $rowContent .= $this->newCell(
                        $total,
                        $index,
                        $record,
                        $colAttributes,
                        $colContent
                    );
                }

                $rowAttributes = $this->getRowAttributes($total, $index, $record);

                $rows[] = $this->newRow($total, $index, $record, $rowAttributes, $rowContent);
            }
            $content['body'] = implode("\n", $rows);
        }

        // Display a message when the grid field is empty.
        if (empty($content['body'])) {
            $cell = HTML::createTag(
                'td',
                array(
                    'colspan' => count($columns),
                ),
                _t('SilverStripe\\Forms\\GridField\\GridField.NoItemsFound', 'No items found')
            );

            $row = HTML::createTag(
                'tr',
                array(
                    'class' => 'ss-gridfield-item ss-gridfield-no-items',
                ),
                $cell
            );

            $content['body'] = $row;
        }

        $header = $this->getOptionalTableHeader($content);
        $body = $this->getOptionalTableBody($content);
        $footer = $this->getOptionalTableFooter($content);

        $this->addExtraClass('ss-gridfield grid-field field');

        $fieldsetAttributes = array_diff_key(
            $this->getAttributes(),
            array(
                'value' => false,
                'type' => false,
                'name' => false,
            )
        );

        $fieldsetAttributes['data-name'] = $this->getName();

        $tableId = null;

        if ($this->id) {
            $tableId = $this->id;
        }

        $tableAttributes = array(
            'id' => $tableId,
            'class' => 'table grid-field__table',
            'cellpadding' => '0',
            'cellspacing' => '0'
        );

        if ($this->getDescription()) {
            $content['after'] .= HTML::createTag(
                'span',
                array('class' => 'description'),
                $this->getDescription()
            );
        }

        $table = HTML::createTag(
            'table',
            $tableAttributes,
            $header . "\n" . $footer . "\n" . $body
        );

        return HTML::createTag(
            'fieldset',
            $fieldsetAttributes,
            $content['before'] . $table . $content['after']
        );
    }
451491
public function Field($properties = [])
    {
        $label = $this->valueToLabel();
        if (!is_null($label)) {
            $attrValue = Convert::raw2xml($label);
            $inputValue = $this->value;
        } else {
            $attrValue = '<i>(' . _t('SilverStripe\\Forms\\FormField.NONE', 'none') . ')</i>';
            $inputValue = '';
        }

        $properties = array_merge($properties, array(
            'AttrValue' => DBField::create_field('HTMLFragment', $attrValue),
            'InputValue' => $inputValue
        ));

        return parent::Field($properties);
    }
543684
protected function renderProperties( array $values  = array(),
                                         array $addAttr = array() )
    {
        $markup = '';

        foreach ( $values as $key => $data )
        {
            if ( is_string( $key ) && isset( $data['value'] ) )
            {
                $markup .= $this->renderProperty(
                    $key,
                    $data['value'],
                    ! empty( $data['priority'] ),
                    $addAttr
                );
            }
        }

        return $markup;
    }
96605
public function Field($properties = [])
    {
        // Requirements::css(SAPPHIRE_DIR . '/css/CheckboxSetField.css');

        $source = $this->source;
        $values = $this->value;
        if ($values instanceof MultiValueField) {
            $values = $values->getValues();

            if ($this->storeKeys && is_array($values)) {
                // use the keys instead, as that's how we've stored things
                $values = array_keys($values);
            }
        }

        // Get values from the join, if available
        if (is_object($this->form)) {
            $record = $this->form->getRecord();
            if (!$values && $record && $record->{$this->name}) {
                $prop = $record->{$this->name};
                if ($prop && $prop instanceof MultiValueField) {
                    $values = $prop->getValues();
                }
            }
        }

        // Source is not an array
        if (!is_array($source) && !is_a($source, 'SQLMap')) {
            if (is_array($values)) {
                $items = $values;
            } else {
                // Source and values are DataObject sets.
                if ($values && is_a($values, 'DataObjectSet')) {
                    foreach ($values as $object) {
                        if (is_a($object, DataObject::class)) {
                            $items[] = $object->ID;
                        }
                    }
                } elseif ($values && is_string($values)) {
                    $items = explode(',', $values);
                    $items = str_replace('{comma}', ',', $items);
                }
            }
        } else {
            // Sometimes we pass a singluar default value thats ! an array && !DataObjectSet
            if (is_a($values, 'DataObjectSet') || is_array($values)) {
                $items = $values;
            } else {
                $items = explode(',', $values);
                $items = str_replace('{comma}', ',', $items);
            }
        }

        if (is_array($source)) {
            unset($source['']);
        }

        $odd     = 0;
        $options = '';

        if ($source == null) {
            $source  = [];
            $options = "<li>"
                ._t('MultiValueCheckboxField.NoOptions', 'No options available')
                ."</li>";
        }

        if ($source)
                foreach ($source as $index => $item) {
                if (is_a($item, DataObject::class)) {
                    $key   = $item->ID;
                    $value = $item->Title;
                } else {
                    $key   = $index;
                    $value = $item;
                }

                $odd        = ($odd + 1) % 2;
                $extraClass = $odd ? 'odd' : 'even';
                $extraClass .= ' val'.str_replace(' ', '', $key);
                $itemID     = $this->id().'_'.preg_replace('/[^a-zA-Z0-9]+/', '', $key);
                $checked    = '';
                if (isset($items)) {
                    $checked = (in_array($key, $items) || in_array($key, $this->defaultItems)) ? ' checked="checked"' : '';
                }

                $disabled = ($this->disabled || in_array($key, $this->disabledItems)) ? $disabled = ' disabled="disabled"'
                        : '';
                $options  .= "<li class=\"$extraClass\"><input id=\"$itemID\" name=\"$this->name[$key]\" type=\"checkbox\" value=\"$key\"$checked $disabled class=\"checkbox\" /> <label for=\"$itemID\">$value</label></li>\n";
            }

        return "<ul id=\"{$this->id()}\" class=\"optionset checkboxsetfield{$this->extraClass()}\">\n$options</ul>\n";
    }
729
public function Field($properties = array())
    {
        if ($this->value) {
            $val = Convert::raw2xml($this->value);
            $val = DBCurrency::config()->get('currency_symbol')
                . number_format(preg_replace('/[^0-9.-]/', '', $val), 2);
            $valforInput = Convert::raw2att($val);
        } else {
            $valforInput = '';
        }
        return "<input class=\"text\" type=\"text\" disabled=\"disabled\""
        . " name=\"" . $this->name . "\" value=\"" . $valforInput . "\" />";
    }
691254
protected function _identity($properties)
    {
        $fields = [];
        foreach ($properties as $property) {
            $value = $this->$property;
            if ($value !== null && $value !== UNDEFINED) {
                $fields[] = $property . '=' . (is_string($value) ? '"' . $value . '"' : $value);
            }
        }
        return '@' . str_replace('OpenApi\\Annotations\\', 'OA\\', get_class($this)) . '(' . implode(',', $fields) . ')';
    }
158271
public function Field($properties = [])
    {
        Requirements::javascript("silvercommerce/geozones: client/dist/js/RegionSelectionField.min.js");

        $country_field = $this->country_field;
        
        // Get source based on selected country (or current/default locale)
        $field = $this
            ->getForm()
            ->Fields()
            ->dataFieldByName($country_field);
        
        // Add reference to base field
        $this
            ->setAttribute("data-region-field", true)
            ->setAttribute("data-country-field", $field->ID())
            ->setAttribute("data-link", $this->Link("regionslist"));
        
        if ($this->getHasEmptyDefault()) {
            $this->setAttribute("data-empty-string", $this->getEmptyString());
        }

        return parent::Field($properties);
    }
612895
protected function setPlaceholder(array $properties)
    {
        $labels = $this->getPlaceholderFromArray($properties);

        foreach ($labels as $label) {
            $this->addPlaceholder($label->text, $label->isPlain, $label->lang);
        }

        return $this;
    }
346856
protected function setLabelsProperty(array $properties)
    {
        $labels = $this->getLabelsFromProperties($properties);

        foreach ($labels as $label) {
            $this->addLabel($label->text, $label->isPlain, $label->lang);
        }

        return $this;
    }
328184
public function setProperties(array $properties = null)
    {
        ValidationUtility::ensureNullOrArrayOfType(
            '$properties', $properties, __NAMESPACE__ . '\Property');

        $this->properties = $properties;

        return $this;
    }
597608
public function withProperties(array $properties): self
    {
        $query = $this;

        foreach ($properties as $property => $cypher) {
            $query = $query->withProperty($property, $cypher);
        }

        return $query;
    }
1093742
public function setRange(array $properties)
    {
        if (self::isValidSelectRangeType($properties)) {
            $this->range = explode(':', substr($properties['html-type'], 12));
        }

        if (Helpers::isKeyExists($properties, 'range') && is_array($properties['range'])) {
            $this->range = $properties['range'];
        }

        return $this;
    }
1238017
public function Field($properties = array())
    {
        $context = $this;
        $properties['Editable'] = $this->editable;
        $properties['Reservation'] = $this->getReservation();
        $properties['Attendees'] = $this->editable
            ? $this->getEditableAttendees()
            : $this->getReservation()->Attendees();

        if (count($properties)) {
            $context = $context->customise($properties);
        }

        $this->extend('onBeforeRender', $context);

        $result = $context->renderWith($this->getTemplates());

        if (is_string($result)) {
            $result = trim($result);
        } else {
            if ($result instanceof DBField) {
                $result->setValue(trim($result->getValue()));
            }
        }

        return $result;
    }
701959
public function Field($properties = array())
    {
        if ($this->isReadonly()) {
            $nullableCheckbox = new CheckboxField_Readonly($this->getIsNullId());
        } else {
            $nullableCheckbox = new CheckboxField($this->getIsNullId());
        }

        $nullableCheckbox->setValue(is_null($this->dataValue()));

        return sprintf(
            '%s %s&nbsp;<span>%s</span>',
            $this->valueField->Field(),
            $nullableCheckbox->Field(),
            $this->getIsNullLabel()
        );
    }
109505
protected function setHtmlType(array &$fields)
    {
        foreach ($fields as $field) {
            $field->htmlType = $this->getHtmlType($field->getEloquentDataMethod());
        }

        return $this;
    }
1110835
private function getXmlString(array $fields = []): string
    {
        $xmlData = [];
        $xmlData[] = '<Row>';
        foreach ($fields as $key => $value) {
            $value = htmlspecialchars($value);

            $value = str_replace(["\r\n", "\r", "\n"], '&#10;', $value);
            $dataType = 'String';
            if (0 !== $this->position || !$this->showHeaders) {
                $dataType = $this->getDataType((string) $key, $value);
            }
            $xmlData[] = '<Cell><Data ss:Type="'.$dataType.'">'.$value.'</Data></Cell>';
        }
        $xmlData[] = '</Row>';

        return implode('', $xmlData);
    }