You are here

public function PathAlias::settingsForm in Freelinking 4.0.x

Same name and namespace in other branches
  1. 8.3 src/Plugin/freelinking/PathAlias.php \Drupal\freelinking\Plugin\freelinking\PathAlias::settingsForm()

Plugin configuration form.

Parameters

array $form: The form element array for the filter plugin.

\Drupal\Core\Form\FormStateInterface $form_state: The form state of the parent form.

Return value

array The configuration form to attach to Freelinking settings form.

Overrides FreelinkingPluginBase::settingsForm

File

src/Plugin/freelinking/PathAlias.php, line 89

Class

PathAlias
Freelinking path plugin.

Namespace

Drupal\freelinking\Plugin\freelinking

Code

public function settingsForm(array $form, FormStateInterface $form_state) {
  $element['failover'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('If path alias is not found'),
    '#description' => $this
      ->t('What should freelinking do when the page is not found?'),
    '#options' => [
      'error' => $this
        ->t('Insert an error message'),
    ],
  ];
  if ($this->moduleHandler
    ->moduleExists('search')) {
    $element['failover']['#options']['search'] = $this
      ->t('Add link to search content');
  }
  return $element;
}