You are here

public function DateTimeEnhancerBase::getSettingsForm in JSON:API Extras 8

Same name and namespace in other branches
  1. 8.3 src/Plugin/DateTimeEnhancerBase.php \Drupal\jsonapi_extras\Plugin\DateTimeEnhancerBase::getSettingsForm()
  2. 8.2 src/Plugin/DateTimeEnhancerBase.php \Drupal\jsonapi_extras\Plugin\DateTimeEnhancerBase::getSettingsForm()

Get a form element to render the settings.

Parameters

array $resource_field_info: The resource field info.

Return value

array The form element array.

Overrides ResourceFieldEnhancerBase::getSettingsForm

File

src/Plugin/DateTimeEnhancerBase.php, line 41

Class

DateTimeEnhancerBase
Base class for date and time based resourceFieldEnhancer plugins.

Namespace

Drupal\jsonapi_extras\Plugin

Code

public function getSettingsForm(array $resource_field_info) {
  $settings = empty($resource_field_info['enhancer']['settings']) ? $this
    ->getConfiguration() : $resource_field_info['enhancer']['settings'];
  return [
    'dateTimeFormat' => [
      '#type' => 'textfield',
      '#title' => $this
        ->t('Format'),
      '#description' => $this
        ->t('Use a valid date format.'),
      '#default_value' => $settings['dateTimeFormat'],
    ],
  ];
}