Drupal 8  8.0.2
LanguageNegotiationContentEntity Class Reference
Inheritance diagram for LanguageNegotiationContentEntity:

Public Member Functions

 __construct (EntityManagerInterface $entity_manager)
 
 getLangcode (Request $request=NULL)
 
 processOutbound ($path, &$options=[], Request $request=NULL, BubbleableMetadata $bubbleable_metadata=NULL)
 
 getLanguageSwitchLinks (Request $request, $type, Url $url)
 
- Public Member Functions inherited from LanguageNegotiationMethodBase
 setLanguageManager (ConfigurableLanguageManagerInterface $language_manager)
 
 setConfig (ConfigFactoryInterface $config)
 
 setCurrentUser (AccountInterface $current_user)
 
 persist (LanguageInterface $language)
 
- Public Member Functions inherited from LanguageSwitcherInterface
 getLanguageSwitchLinks (Request $request, $type, Url $url)
 

Static Public Member Functions

static create (ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition)
 

Data Fields

const METHOD_ID = 'language-content-entity'
 
const QUERY_PARAMETER = 'language_content_entity'
 

Protected Member Functions

 hasLowerLanguageNegotiationWeight ()
 
 meetsContentEntityRoutesCondition (Route $outbound_route, Request $request)
 
 getContentEntityTypeIdForCurrentRequest (Request $request)
 
 getContentEntityPaths ()
 

Protected Attributes

 $contentEntityPaths
 
 $hasLowerLanguageNegotiationWeightResult
 
 $paths
 
 $entityManager
 
- Protected Attributes inherited from LanguageNegotiationMethodBase
 $languageManager
 
 $config
 
 $currentUser
 

Detailed Description

Class for identifying the content translation language.

( id = Drupal::METHOD_ID, types = {Drupal::TYPE_CONTENT}, weight = -9, name = ("Content language"), description = ("Determines the content language from a request parameter."), )

Constructor & Destructor Documentation

__construct ( EntityManagerInterface  $entity_manager)

Constructs a new LanguageNegotiationContentEntity instance.

Parameters
\Drupal\Core\Entity\EntityManagerInterface$entity_managerThe entity manager.

References Drupal\entityManager().

Here is the call graph for this function:

Member Function Documentation

static create ( ContainerInterface  $container,
array  $configuration,
  $plugin_id,
  $plugin_definition 
)
static

{Creates an instance of the plugin.

Parameters
\Symfony\Component\DependencyInjection\ContainerInterface$containerThe container to pull out services used in the plugin.
array$configurationA configuration array containing information about the plugin instance.
string$plugin_idThe plugin ID for the plugin instance.
mixed$plugin_definitionThe plugin implementation definition.
Returns
static Returns an instance of this plugin.
}

Implements ContainerFactoryPluginInterface.

getContentEntityPaths ( )
protected

Returns the paths for the link templates of all content entities.

Returns
array An array of all content entity type IDs, keyed by the corresponding link template paths.

References Drupal\entityManager().

Referenced by LanguageNegotiationContentEntity\getContentEntityTypeIdForCurrentRequest(), and LanguageNegotiationContentEntity\meetsContentEntityRoutesCondition().

Here is the call graph for this function:

Here is the caller graph for this function:

getContentEntityTypeIdForCurrentRequest ( Request  $request)
protected

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

Parameters
\Symfony\Component\HttpFoundation\Request$requestThe HttpRequest object representing the current request.
Returns
string The entity type ID for the route from the request.

References LanguageNegotiationContentEntity\getContentEntityPaths().

Referenced by LanguageNegotiationContentEntity\meetsContentEntityRoutesCondition().

Here is the call graph for this function:

Here is the caller graph for this function:

getLangcode ( Request  $request = NULL)

{Performs language negotiation.

Parameters
\Symfony\Component\HttpFoundation\Request$request(optional) The current request. Defaults to NULL if it has not been initialized yet.
Returns
string A valid language code or FALSE if the negotiation was unsuccessful.
}

Implements LanguageNegotiationMethodInterface.

References Drupal\languageManager().

Referenced by LanguageNegotiationContentEntity\processOutbound().

Here is the call graph for this function:

Here is the caller graph for this function:

getLanguageSwitchLinks ( Request  $request,
  $type,
Url  $url 
)

{}

References Drupal\languageManager().

Here is the call graph for this function:

hasLowerLanguageNegotiationWeight ( )
protected

Determines if content entity language negotiator has higher priority.

The content entity language negotiator having higher priority than the url language negotiator, is a criteria in ::processOutbound().

Returns
bool TRUE if the content entity language negotiator has higher priority than the url language negotiator, FALSE otherwise.

References Drupal\config(), LanguageNegotiationUI\METHOD_ID, and LanguageNegotiationUrl\METHOD_ID.

Referenced by LanguageNegotiationContentEntity\processOutbound().

Here is the call graph for this function:

Here is the caller graph for this function:

meetsContentEntityRoutesCondition ( Route  $outbound_route,
Request  $request 
)
protected

Determines if content entity route condition is met.

Requirements: currently being on an content entity route and processing outbound url pointing to the same content entity.

Parameters
\Symfony\Component\Routing\Route$outbound_routeThe route object for the current outbound url being processed.
\Symfony\Component\HttpFoundation\Request$requestThe HttpRequest object representing the current request.
Returns
bool TRUE if the content entity route condition is met, FALSE otherwise.

References LanguageNegotiationContentEntity\getContentEntityPaths(), and LanguageNegotiationContentEntity\getContentEntityTypeIdForCurrentRequest().

Referenced by LanguageNegotiationContentEntity\processOutbound().

Here is the call graph for this function:

Here is the caller graph for this function:

processOutbound (   $path,
$options = [],
Request  $request = NULL,
BubbleableMetadata  $bubbleable_metadata = NULL 
)

{Processes the outbound path.

Parameters
string$pathThe path to process, with a leading slash.
array$options(optional) An associative array of additional options, with the following elements:
  • 'query': An array of query key/value-pairs (without any URL-encoding) to append to the URL.
  • 'fragment': A fragment identifier (named anchor) to append to the URL. Do not include the leading '#' character.
  • 'absolute': Defaults to FALSE. Whether to force the output to be an absolute link (beginning with http:). Useful for links that will be displayed outside the site, such as in an RSS feed.
  • 'language': An optional language object used to look up the alias for the URL. If $options['language'] is omitted, it defaults to the current language for the language type LanguageInterface::TYPE_URL.
  • 'https': Whether this URL should point to a secure location. If not defined, the current scheme is used, so the user stays on HTTP or HTTPS respectively. TRUE enforces HTTPS and FALSE enforces HTTP.
  • 'base_url': Only used internally by a path processor, for example, to modify the base URL when a language dependent URL requires so.
  • 'prefix': Only used internally, to modify the path when a language dependent URL requires so.
  • 'route': The route object for the given path. It will be set by ::generateFromRoute().
\Symfony\Component\HttpFoundation\Request$requestThe HttpRequest object representing the current request.
\Drupal\Core\Render\BubbleableMetadata$bubbleable_metadata(optional) Object to collect path processors' bubbleable metadata.
Returns
string The processed path.
}

Implements OutboundPathProcessorInterface.

References UrlHelper\buildQuery(), LanguageNegotiationContentEntity\getLangcode(), LanguageNegotiationContentEntity\hasLowerLanguageNegotiationWeight(), and LanguageNegotiationContentEntity\meetsContentEntityRoutesCondition().

Here is the call graph for this function:

Field Documentation

const METHOD_ID = 'language-content-entity'
const QUERY_PARAMETER = 'language_content_entity'

The documentation for this class was generated from the following file: