You are here

public function Link::settingsForm in Display Suite 8.4

Same name and namespace in other branches
  1. 8.2 src/Plugin/DsField/Link.php \Drupal\ds\Plugin\DsField\Link::settingsForm()
  2. 8.3 src/Plugin/DsField/Link.php \Drupal\ds\Plugin\DsField\Link::settingsForm()

The form that holds the settings for this plugin.

Parameters

array $form: The form definition array for the field configuration form.

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

Return value

array The renderable form array representing the entire configuration form.

Overrides DsFieldBase::settingsForm

File

src/Plugin/DsField/Link.php, line 15

Class

Link
Plugin that renders a link.

Namespace

Drupal\ds\Plugin\DsField

Code

public function settingsForm($form, FormStateInterface $form_state) {
  $config = $this
    ->getConfiguration();
  $form['link text'] = [
    '#type' => 'textfield',
    '#title' => 'Link text',
    '#default_value' => $config['link text'],
  ];
  $form['link class'] = [
    '#type' => 'textfield',
    '#title' => 'Link class',
    '#default_value' => $config['link class'],
    '#description' => $this
      ->t('Put a class on the link. Eg: btn btn-default'),
  ];
  $form['wrapper'] = [
    '#type' => 'textfield',
    '#title' => 'Wrapper',
    '#default_value' => $config['wrapper'],
    '#description' => $this
      ->t('Eg: h1, h2, p'),
  ];
  $form['class'] = [
    '#type' => 'textfield',
    '#title' => 'Class',
    '#default_value' => $config['class'],
    '#description' => $this
      ->t('Put a class on the wrapper. Eg: block-title'),
  ];
  return $form;
}