You are here

protected function LanguageNegotiationContentEntity::getContentEntityTypeIdForCurrentRequest in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationContentEntity.php \Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationContentEntity::getContentEntityTypeIdForCurrentRequest()

Returns the content entity type ID from the current request for the route.

Parameters

\Symfony\Component\HttpFoundation\Request $request: The HttpRequest object representing the current request.

Return value

string The entity type ID for the route from the request.

1 call to LanguageNegotiationContentEntity::getContentEntityTypeIdForCurrentRequest()
LanguageNegotiationContentEntity::meetsContentEntityRoutesCondition in core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationContentEntity.php
Determines if content entity route condition is met.

File

core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationContentEntity.php, line 261
Contains \Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationContentEntity.

Class

LanguageNegotiationContentEntity
Class for identifying the content translation language.

Namespace

Drupal\language\Plugin\LanguageNegotiation

Code

protected function getContentEntityTypeIdForCurrentRequest(Request $request) {
  $content_entity_type_id_for_current_route = '';
  if ($current_route = $request->attributes
    ->get(RouteObjectInterface::ROUTE_OBJECT)) {
    $current_route_path = $current_route
      ->getPath();
    $content_entity_type_id_for_current_route = isset($this
      ->getContentEntityPaths()[$current_route_path]) ? $this
      ->getContentEntityPaths()[$current_route_path] : '';
  }
  return $content_entity_type_id_for_current_route;
}