function AdminPathConfigEntityConverter::applies

Same name in this branch
  1. 11.x core/lib/Drupal/Core/ProxyClass/ParamConverter/AdminPathConfigEntityConverter.php \Drupal\Core\ProxyClass\ParamConverter\AdminPathConfigEntityConverter::applies()
Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/ProxyClass/ParamConverter/AdminPathConfigEntityConverter.php \Drupal\Core\ProxyClass\ParamConverter\AdminPathConfigEntityConverter::applies()
  2. 9 core/lib/Drupal/Core/ParamConverter/AdminPathConfigEntityConverter.php \Drupal\Core\ParamConverter\AdminPathConfigEntityConverter::applies()
  3. 8.9.x core/lib/Drupal/Core/ProxyClass/ParamConverter/AdminPathConfigEntityConverter.php \Drupal\Core\ProxyClass\ParamConverter\AdminPathConfigEntityConverter::applies()
  4. 8.9.x core/lib/Drupal/Core/ParamConverter/AdminPathConfigEntityConverter.php \Drupal\Core\ParamConverter\AdminPathConfigEntityConverter::applies()
  5. 10 core/lib/Drupal/Core/ProxyClass/ParamConverter/AdminPathConfigEntityConverter.php \Drupal\Core\ProxyClass\ParamConverter\AdminPathConfigEntityConverter::applies()
  6. 10 core/lib/Drupal/Core/ParamConverter/AdminPathConfigEntityConverter.php \Drupal\Core\ParamConverter\AdminPathConfigEntityConverter::applies()

Overrides EntityConverter::applies

1 call to AdminPathConfigEntityConverter::applies()
ViewUIConverter::applies in core/modules/views_ui/src/ParamConverter/ViewUIConverter.php
Determines if the converter applies to a specific route and variable.
1 method overrides AdminPathConfigEntityConverter::applies()
ViewUIConverter::applies in core/modules/views_ui/src/ParamConverter/ViewUIConverter.php
Determines if the converter applies to a specific route and variable.

File

core/lib/Drupal/Core/ParamConverter/AdminPathConfigEntityConverter.php, line 87

Class

AdminPathConfigEntityConverter
Makes sure the unmodified ConfigEntity is loaded on admin pages.

Namespace

Drupal\Core\ParamConverter

Code

public function applies($definition, $name, Route $route) {
    if (isset($definition['with_config_overrides']) && $definition['with_config_overrides']) {
        return FALSE;
    }
    if (parent::applies($definition, $name, $route)) {
        $entity_type_id = substr($definition['type'], strlen('entity:'));
        // If the entity type is dynamic, defer checking to self::convert().
        if (str_starts_with($entity_type_id, '{')) {
            return TRUE;
        }
        // As we only want to override EntityConverter for ConfigEntities, find
        // out whether the current entity is a ConfigEntity.
        $entity_type = $this->entityTypeManager
            ->getDefinition($entity_type_id);
        if ($entity_type->entityClassImplements(ConfigEntityInterface::class)) {
            return $this->adminContext
                ->isAdminRoute($route);
        }
    }
    return FALSE;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.