// Filter out the bundles the user doesn't have access to.
$access_control_handler =
$this->entityTypeManager->
getAccessControlHandler($entity_type_id);
foreach ($bundles as $bundle_name =>
$bundle_info) { $access =
$access_control_handler->
createAccess($bundle_name, NULL,
[], TRUE
);
if (!
$access->
isAllowed()) { unset($bundles[$bundle_name]);
} $this->renderer->
addCacheableDependency($build,
$access);
} // Add descriptions from the bundle entities.
$bundles =
$this->
loadBundleDescriptions($bundles,
$bundle_entity_type);
} else { $bundle_argument =
$bundle_key;
} $form_route_name = 'entity.' .
$entity_type_id . '.add_form';
// Redirect if there's only one bundle available.
if (count($bundles) == 1
) { $bundle_names =
array_keys($bundles);
$bundle_name =
reset($bundle_names);
$parameters =
$this->routeMatch->
getRawParameters()->
all();