public function LazyFilter::settingsForm in Lazy-load 8.3
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
- src/
Plugin/ Filter/ LazyFilter.php, line 81
Class
- LazyFilter
- Provides a filter to lazy-load images.
Namespace
Drupal\lazy\Plugin\FilterCode
public function settingsForm(array $form, FormStateInterface $form_state) {
$form['info'] = [
'#markup' => $this
->t('Lazy-load filter can be enabled for images and iframes.'),
];
$form['image'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Enable for images (%img tags)', [
'%img' => '<img>',
]),
"#description" => $this
->t('This option only applies to inline-images. If <em>Embed media</em> filter is enabled, the images embedded from media library would use the the selected view mode settings.'),
'#default_value' => $this->settings['image'],
'#return_value' => TRUE,
];
$form['iframe'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Enable for iframes (%iframe tags)', [
'%iframe' => '<iframe>',
]),
'#default_value' => $this->settings['iframe'],
'#return_value' => TRUE,
];
return $form;
}