public function LinkWidget::settingsForm

Implements Drupal\field\Plugin\Type\Widget\WidgetInterface::settingsForm().

Overrides WidgetBase::settingsForm

File

drupal/core/modules/link/lib/Drupal/link/Plugin/field/widget/LinkWidget.php, line 85
Contains \Drupal\link\Plugin\field\widget\LinkWidget.

Class

LinkWidget
Plugin implementation of the 'link' widget.

Namespace

Drupal\link\Plugin\field\widget

Code

public function settingsForm(array $form, array &$form_state) {
  $elements = parent::settingsForm($form, $form_state);
  $elements['placeholder_url'] = array(
    '#type' => 'textfield',
    '#title' => t('Placeholder for URL'),
    '#default_value' => $this
      ->getSetting('placeholder_url'),
    '#description' => t('Text that will be shown inside the field until a value is entered. This hint is usually a sample value or a brief description of the expected format.'),
  );
  $elements['placeholder_title'] = array(
    '#type' => 'textfield',
    '#title' => t('Placeholder for link text'),
    '#default_value' => $this
      ->getSetting('placeholder_title'),
    '#description' => t('Text that will be shown inside the field until a value is entered. This hint is usually a sample value or a brief description of the expected format.'),
    '#states' => array(
      'invisible' => array(
        ':input[name="instance[settings][title]"]' => array(
          'value' => DRUPAL_DISABLED,
        ),
      ),
    ),
  );
  return $elements;
}