public function FormModeManager::getActiveDisplays in Form mode manager 8.2
Same name and namespace in other branches
- 8 src/FormModeManager.php \Drupal\form_mode_manager\FormModeManager::getActiveDisplays()
Returns entity (form) displays for the current entity display type.
Parameters
string $entity_type_id: The entity type ID to check active modes.
Return value
array The Display mode id for defined entity_type_id.
Overrides FormModeManagerInterface::getActiveDisplays
1 call to FormModeManager::getActiveDisplays()
- FormModeManager::filterInactiveDisplay in src/
FormModeManager.php - Filter form mode collection depending activation in bundle.
File
- src/
FormModeManager.php, line 86
Class
- FormModeManager
- FormDisplayManager service.
Namespace
Drupal\form_mode_managerCode
public function getActiveDisplays($entity_type_id) {
$form_mode_ids = [];
$ids = $this->configFactory
->listAll(self::ENTITY_FORM_DISPLAY_CONFIG_PREFIX . '.' . $entity_type_id . '.');
/** @var \Drupal\Core\Entity\Entity\EntityFormDisplay[] $entity_storage */
$entity_storage = $this->entityTypeManager
->getStorage('entity_form_display')
->loadMultiple($this
->getEntityFormDisplayIds($ids));
if (empty($entity_storage)) {
return [];
}
foreach ($entity_storage as $form_mode) {
$form_mode_ids[$form_mode
->getMode()] = $form_mode;
}
return $form_mode_ids;
}