Drupal 8  8.0.2
StaticMenuLinkOverrides Class Reference
Inheritance diagram for StaticMenuLinkOverrides:

Public Member Functions

 __construct (ConfigFactoryInterface $config_factory)
 
 reload ()
 
 loadOverride ($id)
 
 deleteMultipleOverrides (array $ids)
 
 deleteOverride ($id)
 
 loadMultipleOverrides (array $ids)
 
 saveOverride ($id, array $definition)
 
 getCacheTags ()
 

Protected Member Functions

 getConfig ()
 

Static Protected Member Functions

static encodeId ($id)
 

Protected Attributes

 $configName = 'core.menu.static_menu_link_overrides'
 
 $config
 
 $configFactory
 

Detailed Description

Defines an implementation of the menu link override using a config file.

Constructor & Destructor Documentation

__construct ( ConfigFactoryInterface  $config_factory)

Constructs a StaticMenuLinkOverrides object.

Parameters
\Drupal\Core\Config\ConfigFactoryInterface$config_factoryA configuration factory instance.

References Drupal\configFactory().

Here is the call graph for this function:

Member Function Documentation

deleteMultipleOverrides ( array  $ids)

{Deletes multiple overrides to definitions of static (YAML-defined) links.

Parameters
array$idsArray of menu link plugin IDs.
}

Implements StaticMenuLinkOverridesInterface.

References StaticMenuLinkOverrides\getConfig().

Referenced by StaticMenuLinkOverrides\deleteOverride().

Here is the call graph for this function:

Here is the caller graph for this function:

deleteOverride (   $id)

{Deletes any overrides to the definition of a static (YAML-defined) link.

Parameters
string$idA menu link plugin ID.
}

Implements StaticMenuLinkOverridesInterface.

References StaticMenuLinkOverrides\deleteMultipleOverrides().

Here is the call graph for this function:

static encodeId (   $id)
staticprotected

Encodes the ID by replacing dots with double underscores.

This is done because config schema uses dots for its internal type hierarchy. Double underscores are converted to triple underscores to avoid accidental conflicts.

Parameters
string$idThe menu plugin ID.
Returns
string The menu plugin ID with double underscore instead of dots.
getCacheTags ( )

{The unique cache tag associated with this menu link override.

Returns
string[] An array of cache tags.
}

Implements StaticMenuLinkOverridesInterface.

References StaticMenuLinkOverrides\getConfig().

Here is the call graph for this function:

getConfig ( )
protected

Gets the configuration object when needed.

Since this service is injected into all static menu link objects, but only used when updating one, avoid actually loading the config when it's not needed.

References Drupal\config(), and Drupal\configFactory().

Referenced by StaticMenuLinkOverrides\deleteMultipleOverrides(), StaticMenuLinkOverrides\getCacheTags(), StaticMenuLinkOverrides\loadMultipleOverrides(), StaticMenuLinkOverrides\loadOverride(), and StaticMenuLinkOverrides\saveOverride().

Here is the call graph for this function:

Here is the caller graph for this function:

loadMultipleOverrides ( array  $ids)

{Loads overrides to multiple definitions of a static (YAML-defined) link.

Parameters
array$idsArray of menu link plugin IDs.
Returns
array One or override keys by plugin ID.
See Also
}

Implements StaticMenuLinkOverridesInterface.

References StaticMenuLinkOverrides\getConfig().

Here is the call graph for this function:

loadOverride (   $id)

{Loads any overrides to the definition of a static (YAML-defined) link.

Parameters
string$idA menu link plugin ID.
Returns
array|NULL An override with following supported keys:
  • parent
  • weight
  • menu_name
  • expanded
  • enabled or NULL if there is no override for the given ID.
}

Implements StaticMenuLinkOverridesInterface.

References StaticMenuLinkOverrides\getConfig().

Referenced by StaticMenuLinkOverrides\saveOverride().

Here is the call graph for this function:

Here is the caller graph for this function:

reload ( )

{Reloads the overrides from config.Forces all overrides to be reloaded from config storage to compare the override value with the value submitted during test form submission.}

Implements StaticMenuLinkOverridesInterface.

References Drupal\config(), and Drupal\configFactory().

Here is the call graph for this function:

saveOverride (   $id,
array  $definition 
)

{Saves the override.

Parameters
string$idA menu link plugin ID.
array$definitionThe definition values to override. Supported keys:
  • menu_name
  • parent
  • weight
  • expanded
  • enabled
Returns
array A list of properties which got saved.
}

Implements StaticMenuLinkOverridesInterface.

References StaticMenuLinkOverrides\getConfig(), and StaticMenuLinkOverrides\loadOverride().

Here is the call graph for this function:


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