You are here

public function UrlLinkEnhancer::getSettingsForm in JSON:API Extras 8.3

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/jsonapi/FieldEnhancer/UrlLinkEnhancer.php, line 89

Class

UrlLinkEnhancer
Add URL aliases to links.

Namespace

Drupal\jsonapi_extras\Plugin\jsonapi\FieldEnhancer

Code

public function getSettingsForm(array $resource_field_info) {
  $settings = empty($resource_field_info['enhancer']['settings']) ? $this
    ->getConfiguration() : $resource_field_info['enhancer']['settings'];
  $form = parent::getSettingsForm($resource_field_info);
  $form['absolute_url'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Get Absolute Urls'),
    '#default_value' => $settings['absolute_url'],
  ];
  return $form;
}