public function access(Route
$route, RouteMatchInterface
$route_match, AccountInterface
$account, string
$bundle = NULL
): AccessResultInterface
{ $access = AccessResult::
neutral();
if ($entity_type_id =
$route->
getDefault('entity_type_id'
)) { if (empty($bundle)) { $entity_type =
$this->entityTypeManager->
getDefinition($entity_type_id);
$bundle =
$route_match->
getRawParameter($entity_type->
getBundleEntityType());
} $field_types =
$this->fieldTypePluginManager->
getDefinitions();
// Allows access if there are any existing fields and the user
// correct permissions.
foreach ($this->entityFieldManager->
getFieldStorageDefinitions($entity_type_id) as $field_storage) { // Do not include fields with
// - non-configurable field storages,
// - locked field storages,
// - field storages that should not be added via user interface,
// - field storages that already have a field in the bundle.