public function CommentPostFormatter::settingsForm in Open Social 8.2
Same name and namespace in other branches
- 8.9 modules/social_features/social_post/src/Plugin/Field/FieldFormatter/CommentPostFormatter.php \Drupal\social_post\Plugin\Field\FieldFormatter\CommentPostFormatter::settingsForm()
- 8 modules/social_features/social_post/src/Plugin/Field/FieldFormatter/CommentPostFormatter.php \Drupal\social_post\Plugin\Field\FieldFormatter\CommentPostFormatter::settingsForm()
- 8.3 modules/social_features/social_post/src/Plugin/Field/FieldFormatter/CommentPostFormatter.php \Drupal\social_post\Plugin\Field\FieldFormatter\CommentPostFormatter::settingsForm()
- 8.4 modules/social_features/social_post/src/Plugin/Field/FieldFormatter/CommentPostFormatter.php \Drupal\social_post\Plugin\Field\FieldFormatter\CommentPostFormatter::settingsForm()
- 8.5 modules/social_features/social_post/src/Plugin/Field/FieldFormatter/CommentPostFormatter.php \Drupal\social_post\Plugin\Field\FieldFormatter\CommentPostFormatter::settingsForm()
- 8.6 modules/social_features/social_post/src/Plugin/Field/FieldFormatter/CommentPostFormatter.php \Drupal\social_post\Plugin\Field\FieldFormatter\CommentPostFormatter::settingsForm()
- 8.7 modules/social_features/social_post/src/Plugin/Field/FieldFormatter/CommentPostFormatter.php \Drupal\social_post\Plugin\Field\FieldFormatter\CommentPostFormatter::settingsForm()
- 8.8 modules/social_features/social_post/src/Plugin/Field/FieldFormatter/CommentPostFormatter.php \Drupal\social_post\Plugin\Field\FieldFormatter\CommentPostFormatter::settingsForm()
- 10.3.x modules/social_features/social_post/src/Plugin/Field/FieldFormatter/CommentPostFormatter.php \Drupal\social_post\Plugin\Field\FieldFormatter\CommentPostFormatter::settingsForm()
- 10.0.x modules/social_features/social_post/src/Plugin/Field/FieldFormatter/CommentPostFormatter.php \Drupal\social_post\Plugin\Field\FieldFormatter\CommentPostFormatter::settingsForm()
- 10.1.x modules/social_features/social_post/src/Plugin/Field/FieldFormatter/CommentPostFormatter.php \Drupal\social_post\Plugin\Field\FieldFormatter\CommentPostFormatter::settingsForm()
- 10.2.x modules/social_features/social_post/src/Plugin/Field/FieldFormatter/CommentPostFormatter.php \Drupal\social_post\Plugin\Field\FieldFormatter\CommentPostFormatter::settingsForm()
Returns a form to configure settings for the formatter.
Invoked from \Drupal\field_ui\Form\EntityDisplayFormBase to allow administrators to configure the formatter. The field_ui module takes care of handling submitted form values.
Parameters
array $form: The form where the settings form is being included in.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form elements for the formatter settings.
Overrides CommentDefaultFormatter::settingsForm
File
- modules/
social_features/ social_post/ src/ Plugin/ Field/ FieldFormatter/ CommentPostFormatter.php, line 155
Class
- CommentPostFormatter
- Provides a post comment formatter.
Namespace
Drupal\social_post\Plugin\Field\FieldFormatterCode
public function settingsForm(array $form, FormStateInterface $form_state) {
$element = [];
$element['num_comments'] = [
'#type' => 'number',
'#min' => 0,
'#max' => 10,
'#title' => $this
->t('Number of comments'),
'#default_value' => $this
->getSetting('num_comments'),
];
$orders = [
'ASC' => $this
->t('Oldest first'),
'DESC' => $this
->t('Newest first'),
];
$element['order'] = [
'#type' => 'select',
'#title' => $this
->t('Order'),
'#description' => $this
->t('Select the order used to show the list of comments.'),
'#default_value' => $this
->getSetting('order'),
'#options' => $orders,
];
return $element;
}