You are here

protected function DateTimeCustomListFormatter::postProcessSettingsForm in Formatter Suite 8

Post-processes the settings form after it has been built.

Parameters

array $elements: The form's elements.

Overrides EntityListTrait::postProcessSettingsForm

File

src/Plugin/Field/FieldFormatter/DateTimeCustomListFormatter.php, line 47

Class

DateTimeCustomListFormatter
Formats multiple custom-formatted dates as a list.

Namespace

Drupal\formatter_suite\Plugin\Field\FieldFormatter

Code

protected function postProcessSettingsForm(array $elements) {

  // The Drupal core DateTimeCustomFormatter creates a textfield for the
  // date/time format, but doesn't set the textfield's size. This makes it
  // hard to lay it out in the formatter's UI. So, give it a small size.
  // CSS then widens it to the width of the UI.
  if (isset($elements['date_format']) === TRUE) {
    $elements['date_format']['#size'] = 10;
    $elements['date_format']['#attributes']['size'] = 10;
    $elements['date_format']['#attributes']['spellcheck'] = FALSE;
    $elements['date_format']['#attributes']['autocomplete'] = 'off';
    $elements['date_format']['#attributes']['autocapitalize'] = 'none';
    $elements['date_format']['#attributes']['autocorrect'] = 'off';
  }
  return $elements;
}