public function UrlShortener::settingsForm in Shorten URLs 8.2
Same name and namespace in other branches
- 8 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 31
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'] = [
'#type' => 'radios',
'#title' => t('Behavior'),
'#default_value' => $this->settings['shortener_url_behavior'],
'#options' => [
'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'] = [
'#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;
}