You are here

public function ActivityEntityReferenceFormatter::settingsForm in Open Social 8.2

Same name and namespace in other branches
  1. 8.9 modules/custom/activity_viewer/src/Plugin/Field/FieldFormatter/ActivityEntityReferenceFormatter.php \Drupal\activity_viewer\Plugin\Field\FieldFormatter\ActivityEntityReferenceFormatter::settingsForm()
  2. 8 modules/custom/activity_viewer/src/Plugin/Field/FieldFormatter/ActivityEntityReferenceFormatter.php \Drupal\activity_viewer\Plugin\Field\FieldFormatter\ActivityEntityReferenceFormatter::settingsForm()
  3. 8.3 modules/custom/activity_viewer/src/Plugin/Field/FieldFormatter/ActivityEntityReferenceFormatter.php \Drupal\activity_viewer\Plugin\Field\FieldFormatter\ActivityEntityReferenceFormatter::settingsForm()
  4. 8.4 modules/custom/activity_viewer/src/Plugin/Field/FieldFormatter/ActivityEntityReferenceFormatter.php \Drupal\activity_viewer\Plugin\Field\FieldFormatter\ActivityEntityReferenceFormatter::settingsForm()
  5. 8.5 modules/custom/activity_viewer/src/Plugin/Field/FieldFormatter/ActivityEntityReferenceFormatter.php \Drupal\activity_viewer\Plugin\Field\FieldFormatter\ActivityEntityReferenceFormatter::settingsForm()
  6. 8.6 modules/custom/activity_viewer/src/Plugin/Field/FieldFormatter/ActivityEntityReferenceFormatter.php \Drupal\activity_viewer\Plugin\Field\FieldFormatter\ActivityEntityReferenceFormatter::settingsForm()
  7. 8.7 modules/custom/activity_viewer/src/Plugin/Field/FieldFormatter/ActivityEntityReferenceFormatter.php \Drupal\activity_viewer\Plugin\Field\FieldFormatter\ActivityEntityReferenceFormatter::settingsForm()
  8. 8.8 modules/custom/activity_viewer/src/Plugin/Field/FieldFormatter/ActivityEntityReferenceFormatter.php \Drupal\activity_viewer\Plugin\Field\FieldFormatter\ActivityEntityReferenceFormatter::settingsForm()
  9. 10.3.x modules/custom/activity_viewer/src/Plugin/Field/FieldFormatter/ActivityEntityReferenceFormatter.php \Drupal\activity_viewer\Plugin\Field\FieldFormatter\ActivityEntityReferenceFormatter::settingsForm()
  10. 10.0.x modules/custom/activity_viewer/src/Plugin/Field/FieldFormatter/ActivityEntityReferenceFormatter.php \Drupal\activity_viewer\Plugin\Field\FieldFormatter\ActivityEntityReferenceFormatter::settingsForm()
  11. 10.1.x modules/custom/activity_viewer/src/Plugin/Field/FieldFormatter/ActivityEntityReferenceFormatter.php \Drupal\activity_viewer\Plugin\Field\FieldFormatter\ActivityEntityReferenceFormatter::settingsForm()
  12. 10.2.x modules/custom/activity_viewer/src/Plugin/Field/FieldFormatter/ActivityEntityReferenceFormatter.php \Drupal\activity_viewer\Plugin\Field\FieldFormatter\ActivityEntityReferenceFormatter::settingsForm()

File

modules/custom/activity_viewer/src/Plugin/Field/FieldFormatter/ActivityEntityReferenceFormatter.php, line 63

Class

ActivityEntityReferenceFormatter
Provides a custom dynamic entity reference formatter.

Namespace

Drupal\activity_viewer\Plugin\Field\FieldFormatter

Code

public function settingsForm(array $form, FormStateInterface $form_state) {
  $options = $this->entityDisplayRepository
    ->getAllViewModes();
  $only_view_modes = [];
  foreach ($options as $entity) {
    foreach ($entity as $key => $view_mode) {
      $only_view_modes[$key] = $view_mode['label'];
    }
  }
  $elements['view_mode'] = [
    '#type' => 'select',
    '#options' => $only_view_modes,
    '#title' => t('View mode'),
    '#default_value' => $this
      ->getSetting('view_mode'),
    '#required' => TRUE,
  ];
  return $elements;
}