Drupal 8  8.0.2
DynamicMenuLinkMock Class Reference
Inheritance diagram for DynamicMenuLinkMock:

Public Member Functions

 setCurrentUser (AccountInterface $current_user)
 
 getTitle ()
 
 getRouteName ()
 
 getCacheContexts ()
 
- Public Member Functions inherited from PluginBase
 __construct (array $configuration, $plugin_id, $plugin_definition)
 
 getPluginId ()
 
 getBaseId ()
 
 getDerivativeId ()
 
 getPluginDefinition ()
 

Protected Attributes

 $currentUser
 
- Protected Attributes inherited from PluginBase
 $pluginId
 
 $pluginDefinition
 
 $configuration
 

Additional Inherited Members

- Data Fields inherited from PluginBase
const DERIVATIVE_SEPARATOR = ':'
 

Detailed Description

Defines a mock implementation of a dynamic menu link used in tests only.

Has a dynamic route and title. This is rather contrived, but there are valid use cases.

See Also

Member Function Documentation

getCacheContexts ( )

{The cache contexts associated with this object.These identify a specific variation/representation of the object.Cache contexts are tokens: placeholders that are converted to cache keys by the service. The replacement value depends on the request context (the current URL, language, and so on). They're converted before storing an object in cache.

Returns
string[] An array of cache context tokens, used to generate a cache ID.
See Also
::convertTokensToKeys()
}

Implements CacheableDependencyInterface.

getRouteName ( )

{Returns the route name, if available.

Returns
string The name of the route this menu link links to.
}

Implements MenuLinkInterface.

References Drupal\currentUser().

Here is the call graph for this function:

getTitle ( )

{Returns the localized title to be shown for this link.

Returns
string The title of the menu link.
}

Implements MenuLinkInterface.

References Drupal\currentUser().

Here is the call graph for this function:

setCurrentUser ( AccountInterface  $current_user)

Sets the current user.

Allows the menu link to return the right title and route.

Parameters
\Drupal\Core\Session\AccountInterface$current_userThe current user.
Returns
$this

References Drupal\currentUser().

Here is the call graph for this function:


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