function ctools_entity_mask_copy_display_modes

Same name in other branches
  1. 8.x-3.x modules/ctools_entity_mask/ctools_entity_mask.module \ctools_entity_mask_copy_display_modes()

Ensures that mask entity types have the same display modes as masked ones.

Parameters

array $display_modes: The display modes.

See also

hook_entity_view_mode_info_alter()

\Drupal\Core\Entity\EntityDisplayRepository::getAllDisplayModesByEntityType()

2 calls to ctools_entity_mask_copy_display_modes()
ctools_entity_mask_entity_form_mode_info_alter in modules/ctools_entity_mask/ctools_entity_mask.module
Implements hook_entity_form_mode_info_alter().
ctools_entity_mask_entity_view_mode_info_alter in modules/ctools_entity_mask/ctools_entity_mask.module
Implements hook_entity_view_mode_info_alter().

File

modules/ctools_entity_mask/ctools_entity_mask.module, line 24

Code

function ctools_entity_mask_copy_display_modes(array &$display_modes) {
    foreach (\Drupal::entityTypeManager()->getDefinitions() as $id => $entity_type) {
        $mask = $entity_type->get('mask');
        if ($mask && isset($display_modes[$mask])) {
            $display_modes[$id] = $display_modes[$mask];
        }
    }
}