You are here

public function PrivateMessageThreadMemberWidget::settingsForm in Private Message 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/Field/FieldWidget/PrivateMessageThreadMemberWidget.php \Drupal\private_message\Plugin\Field\FieldWidget\PrivateMessageThreadMemberWidget::settingsForm()

Returns a form to configure settings for the widget.

Invoked from \Drupal\field_ui\Form\EntityDisplayFormBase to allow administrators to configure the widget. 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 definition for the widget settings.

Overrides EntityReferenceAutocompleteWidget::settingsForm

File

src/Plugin/Field/FieldWidget/PrivateMessageThreadMemberWidget.php, line 139

Class

PrivateMessageThreadMemberWidget
Defines the private message thread member widget.

Namespace

Drupal\private_message\Plugin\Field\FieldWidget

Code

public function settingsForm(array $form, FormStateInterface $form_state) {
  $form = parent::settingsForm($form, $form_state);

  // This setting has no bearing on this widget, so it is removed.
  unset($form['match_operator']);
  $form['max_members'] = [
    '#type' => 'number',
    '#title' => $this
      ->t('Maximum number of thread members'),
    '#description' => $this
      ->t('The maximum number of members that can be added to the private message conversation. Set to zero (0) to allow unlimited members'),
    '#default_value' => $this
      ->getSetting('max_members'),
    '#min' => 0,
  ];
  return $form;
}