public function UrlShortener::settingsForm in Shorten URLs 8
Same name and namespace in other branches
- 8.2 modules/shortener/src/Plugin/Filter/UrlShortener.php \Drupal\shortener\Plugin\Filter\UrlShortener::settingsForm()
Builds the settings form for the input filter.
Overrides FilterBase::settingsForm
File
- modules/
shortener/ src/ Plugin/ Filter/ UrlShortener.php, line 35 - Contains \Drupal\shortener\Plugin\Filter\UrlShortener.
Class
- UrlShortener
- Provides a filter to limit allowed HTML tags.
Namespace
Drupal\shortener\Plugin\FilterCode
public function settingsForm(array $form, FormStateInterface $form_state) {
$form['shortener_url_behavior'] = array(
'#type' => 'radios',
'#title' => t('Behavior'),
'#default_value' => $this->settings['shortener_url_behavior'],
'#options' => array(
'short' => t('Display the shortened URL by default, and add an "(expand)"/"(shorten)" link'),
'strict' => t('Display the shortened URL by default, and do not allow expanding it'),
'long' => t('Display the full URL by default, and add a "(shorten)"/"(expand)" link'),
),
);
$form['shortener_url_length'] = array(
'#type' => 'textfield',
'#title' => t('Maximum link text length'),
'#default_value' => $this->settings['shortener_url_length'],
'#maxlength' => 4,
'#description' => t('URLs longer than this number of characters will be truncated to prevent long strings that break formatting. The link itself will be retained; just the text portion of the link will be truncated.'),
);
return $form;
}