You are here

public function FormModeManager::getActiveDisplaysByBundle in Form mode manager 8.2

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

Gets the entity form mode info for a specific bundle.

Parameters

string $entity_type_id: The entity type id.

string $bundle_id: Identifier of bundle.

Return value

array|null The form mode activated for defined bundle.

Overrides FormModeManagerInterface::getActiveDisplaysByBundle

File

src/FormModeManager.php, line 231

Class

FormModeManager
FormDisplayManager service.

Namespace

Drupal\form_mode_manager

Code

public function getActiveDisplaysByBundle($entity_type_id, $bundle_id) {
  $form_modes = [];
  $entities_form_modes = $this
    ->getFormModesByEntity($entity_type_id);
  foreach (array_keys($entities_form_modes) as $form_mode_machine_name) {
    if ($this
      ->isActive($entity_type_id, $bundle_id, $form_mode_machine_name)) {
      $form_modes[$entity_type_id][$form_mode_machine_name] = $entities_form_modes[$form_mode_machine_name];
    }
  }
  return $form_modes;
}