public function FieldLimiter::settingsForm in Field Limiter 8
File
- src/
Plugin/ Field/ FieldFormatter/ FieldLimiter.php, line 47
Class
- FieldLimiter
- Plugin implementation of the 'field_limiter' formatter.
Namespace
Drupal\field_limiter\Plugin\Field\FieldFormatterCode
public function settingsForm(array $form, FormStateInterface $form_state) {
if ($this
->getCardinality() == 1) {
return [];
}
$form = parent::settingsForm($form, $form_state);
$form['offset'] = [
'#type' => 'number',
'#title' => $this
->t('Skip items'),
'#default_value' => $this
->getSetting('offset'),
'#required' => TRUE,
'#min' => 0,
'#description' => $this
->t('Number of items to skip from the beginning.'),
];
$form['limit'] = [
'#type' => 'number',
'#title' => $this
->t('Display items'),
'#default_value' => $this
->getSetting('limit'),
'#required' => TRUE,
'#min' => 0,
'#description' => $this
->t('Number of items to display. Set to 0 to display all items.'),
];
return $form;
}