diff --git a/core/lib/Drupal/Core/Entity/EntityManager.php b/core/lib/Drupal/Core/Entity/EntityManager.php index 11b743d..876bd4b 100644 --- a/core/lib/Drupal/Core/Entity/EntityManager.php +++ b/core/lib/Drupal/Core/Entity/EntityManager.php @@ -1102,15 +1102,15 @@ public function getFormModeOptions($entity_type_id) { /** * {@inheritdoc} */ - public function getViewModeOptionsByBundle($entity_type_id, $bundle, $include_disabled = FALSE) { - return $this->getDisplayModeOptionsByBundle('view_mode', $entity_type_id, $bundle, $include_disabled); + public function getViewModeOptionsByBundle($entity_type_id, $bundle) { + return $this->getDisplayModeOptionsByBundle('view_mode', $entity_type_id, $bundle); } /** * {@inheritdoc} */ - public function getFormModeOptionsByBundle($entity_type_id, $bundle, $include_disabled = FALSE) { - return $this->getDisplayModeOptionsByBundle('form_mode', $entity_type_id, $bundle, $include_disabled); + public function getFormModeOptionsByBundle($entity_type_id, $bundle) { + return $this->getDisplayModeOptionsByBundle('form_mode', $entity_type_id, $bundle); } /** @@ -1141,35 +1141,31 @@ protected function getDisplayModeOptions($display_type, $entity_type_id) { * The entity type whose display mode options should be returned. * @param string $bundle * The name of the bundle. - * @param bool $include_disabled - * Include disabled display modes. Defaults to FALSE. * * @return array * An array of display mode labels, keyed by the display mode ID. */ - protected function getDisplayModeOptionsByBundle($display_type, $entity_type_id, $bundle, $include_disabled) { + protected function getDisplayModeOptionsByBundle($display_type, $entity_type_id, $bundle) { // Collect all the entity's display modes. $options = $this->getDisplayModeOptions($display_type, $entity_type_id); - // If needed, filter out modes for which the entity display is disabled - // (or inexistent). - if (!$include_disabled) { - $load_ids = array(); - // Get the list of available entity displays for the current bundle. - foreach (array_keys($options) as $mode) { - $load_ids[] = $entity_type_id . '.' . $bundle . '.' . $mode; - } + // Filter out modes for which the entity display is disabled + // (or non-existent). + $load_ids = array(); + // Get the list of available entity displays for the current bundle. + foreach (array_keys($options) as $mode) { + $load_ids[] = $entity_type_id . '.' . $bundle . '.' . $mode; + } - // Load the corresponding displays. - $displays = $this->getStorage($display_type == 'form_mode' ? 'entity_form_display' : 'entity_view_display') - ->loadMultiple($load_ids); + // Load the corresponding displays. + $displays = $this->getStorage($display_type == 'form_mode' ? 'entity_form_display' : 'entity_view_display') + ->loadMultiple($load_ids); - // Unset the display modes that are not active or do not exist. - foreach (array_keys($options) as $mode) { - $display_id = $entity_type_id . '.' . $bundle . '.' . $mode; - if (!isset($displays[$display_id]) || !$displays[$display_id]->status()) { - unset($options[$mode]); - } + // Unset the display modes that are not active or do not exist. + foreach (array_keys($options) as $mode) { + $display_id = $entity_type_id . '.' . $bundle . '.' . $mode; + if (!isset($displays[$display_id]) || !$displays[$display_id]->status()) { + unset($options[$mode]); } } diff --git a/core/lib/Drupal/Core/Entity/EntityManagerInterface.php b/core/lib/Drupal/Core/Entity/EntityManagerInterface.php index d060b2e..fad1092 100644 --- a/core/lib/Drupal/Core/Entity/EntityManagerInterface.php +++ b/core/lib/Drupal/Core/Entity/EntityManagerInterface.php @@ -456,13 +456,11 @@ public function getFormModeOptions($entity_type_id); * The entity type whose view mode options should be returned. * @param string $bundle * The name of the bundle. - * @param bool $include_disabled - * Include disabled view modes. Defaults to FALSE. * * @return array * An array of view mode labels, keyed by the display mode ID. */ - public function getViewModeOptionsByBundle($entity_type_id, $bundle, $include_disabled = FALSE); + public function getViewModeOptionsByBundle($entity_type_id, $bundle); /** * Returns an array of form mode options by bundle. @@ -471,13 +469,11 @@ public function getViewModeOptionsByBundle($entity_type_id, $bundle, $include_di * The entity type whose form mode options should be returned. * @param string $bundle * The name of the bundle. - * @param bool $include_disabled - * Include disabled form modes. Defaults to FALSE. * * @return array * An array of form mode labels, keyed by the display mode ID. */ - public function getFormModeOptionsByBundle($entity_type_id, $bundle, $include_disabled = FALSE); + public function getFormModeOptionsByBundle($entity_type_id, $bundle); /** * Loads an entity by UUID.