You are here

public function DrupalOrg::settingsForm in Freelinking 8.3

Same name and namespace in other branches
  1. 4.0.x src/Plugin/freelinking/DrupalOrg.php \Drupal\freelinking\Plugin\freelinking\DrupalOrg::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 External::settingsForm

File

src/Plugin/freelinking/DrupalOrg.php, line 80

Class

DrupalOrg
Freelinking drupal.org and drupal.org project plugin.

Namespace

Drupal\freelinking\Plugin\freelinking

Code

public function settingsForm(array $form, FormStateInterface $form_state) {
  $element = parent::settingsForm($form, $form_state);
  $settings = $this
    ->getConfiguration()['settings'];
  $element['node'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('drupal.org nodes'),
    '#description' => $this
      ->t('Should freelinking allow links to any drupal.org node?'),
    '#options' => [
      '0' => $this
        ->t('No'),
      '1' => $this
        ->t('Yes'),
    ],
    '#default_value' => isset($settings['node']) ? $settings['node'] : '1',
  ];
  $element['project'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('drupal.org projects'),
    '#description' => $this
      ->t('Should freelinking allow links to drupal.org projects?'),
    '#options' => [
      '0' => $this
        ->t('No'),
      '1' => $this
        ->t('Yes'),
    ],
    '#default_value' => isset($settings['project']) ? $settings['project'] : '1',
  ];
  return $element;
}