You are here

public function FilterInlineSms::settingsForm in SMS Framework 2.x

Same name and namespace in other branches
  1. 8 modules/sms_sendtophone/src/Plugin/Filter/FilterInlineSms.php \Drupal\sms_sendtophone\Plugin\Filter\FilterInlineSms::settingsForm()
  2. 2.1.x modules/sms_sendtophone/src/Plugin/Filter/FilterInlineSms.php \Drupal\sms_sendtophone\Plugin\Filter\FilterInlineSms::settingsForm()

Generates a filter's settings form.

Parameters

array $form: A minimally prepopulated form array.

\Drupal\Core\Form\FormStateInterface $form_state: The state of the (entire) configuration form.

Return value

array The $form array with additional form elements for the settings of this filter. The submitted form values should match $this->settings.

Overrides FilterBase::settingsForm

File

modules/sms_sendtophone/src/Plugin/Filter/FilterInlineSms.php, line 55

Class

FilterInlineSms
Provides a filter to align elements.

Namespace

Drupal\sms_sendtophone\Plugin\Filter

Code

public function settingsForm(array $form, FormStateInterface $form_state) {
  $elements['display'] = [
    '#type' => 'radios',
    '#title' => t('Show link as'),
    '#description' => t('How to display the the "send to phone" link.'),
    '#options' => [
      'text' => t('Text'),
      'icon' => t('Icon'),
    ],
    '#default_value' => $this->settings['display'],
  ];
  $elements['display_text'] = [
    '#type' => 'textfield',
    '#title' => t('Text for link'),
    '#description' => t('If "Text" is selected above, the following text will be appended as a link.'),
    '#size' => 32,
    '#maxlength' => 32,
    '#default_value' => $this->settings['display_text'],
  ];
  $elements['default_icon'] = [
    '#type' => 'checkbox',
    '#title' => t('Use default icon'),
    '#description' => t('If "Icon" is selected above and this option is enabled, the default icon that came with the module will be used.'),
    '#default_value' => $this->settings['default_icon'],
  ];
  $elements['custom_icon_path'] = [
    '#type' => 'textfield',
    '#title' => t('Path to custom icon'),
    '#description' => t('Provide a path to a custom icon. This icon will be used if "Icon" is selected above and the "Use default icon" option is disabled.'),
    '#size' => 40,
    '#maxlength' => 255,
    '#default_value' => $this->settings['custom_icon_path'],
    '#field_prefix' => Url::fromRoute('<none>', [], [
      'absolute' => TRUE,
    ]),
  ];
  return $elements;
}