You are here

public function FormModeManager::getAllFormModesDefinitions in Form mode manager 8.2

Same name and namespace in other branches
  1. 8 src/FormModeManager.php \Drupal\form_mode_manager\FormModeManager::getAllFormModesDefinitions()

Gets the entity form mode info for all entity types used.

Parameters

bool $ignore_excluded: Joker to determine if form modes to exclude list are used or ignored.

bool $ignore_active_display: Flag to ignore if a form mode is used in bundle display. This parameter doesn't not be activated in entityTypeAlter, context caused by getStorage() call.

Return value

array The collection without uneeded form modes.

Overrides FormModeManagerInterface::getAllFormModesDefinitions

File

src/FormModeManager.php, line 131

Class

FormModeManager
FormDisplayManager service.

Namespace

Drupal\form_mode_manager

Code

public function getAllFormModesDefinitions($ignore_excluded = FALSE, $ignore_active_display = FALSE) {
  $filtered_form_modes = [];
  $form_modes = $this->entityDisplayRepository
    ->getAllFormModes();
  foreach ($form_modes as $entity_type_id => $form_mode) {
    $this
      ->filterExcludedFormModes($form_mode, $entity_type_id, $ignore_excluded);
    if (!$ignore_active_display) {
      $this
        ->filterInactiveDisplay($form_mode, $entity_type_id);
    }
    if (!empty($form_mode)) {
      $filtered_form_modes[$entity_type_id] = $form_mode;
    }
  }
  return $filtered_form_modes;
}