You are here

public function AbstractEntityFormModesFactory::getBundleEntityTypeId in Form mode manager 8.2

Return value

string The bundle entity type id or entity type id of entity.

1 call to AbstractEntityFormModesFactory::getBundleEntityTypeId()
AbstractEntityFormModesFactory::checkAccess in src/AbstractEntityFormModesFactory.php

File

src/AbstractEntityFormModesFactory.php, line 183

Class

AbstractEntityFormModesFactory
Abstract Factory to generate object used by routing of Form Mode Manager.

Namespace

Drupal\form_mode_manager

Code

public function getBundleEntityTypeId(EntityInterface $entity, RouteMatchInterface $route_match) {
  $route = $route_match
    ->getRouteObject();
  $entity_type_id = $route
    ->getOption('_form_mode_manager_entity_type_id');
  if (method_exists($entity, 'bundle') && !empty($entity
    ->bundle())) {
    return $entity
      ->bundle();
  }
  return $entity_type_id;
}