public static function MenuLinkConfiguration::getMenuLinkByIdenfifier in Configuration Management 7.2
Helper function to retrive a menu link based on its identifier.
Parameters
string $identifier: The identifier of the configuration.
boolean $reset: If TRUE the cache of this function is flushed.
Return value
A menu link object.
3 calls to MenuLinkConfiguration::getMenuLinkByIdenfifier()
- MenuLinkConfiguration::alterDependencies in lib/
Drupal/ configuration/ Config/ MenuLinkConfiguration.php - Overrides Drupal\configuration\Config\Configuration::alterDependencies().
- MenuLinkConfiguration::prepareBuild in lib/
Drupal/ configuration/ Config/ MenuLinkConfiguration.php - Overrides Drupal\configuration\Config\Configuration::prepareBuild().
- MenuLinkConfiguration::saveToActiveStore in lib/
Drupal/ configuration/ Config/ MenuLinkConfiguration.php - Overrides Drupal\configuration\Config\Configuration::saveToActiveStore().
File
- lib/
Drupal/ configuration/ Config/ MenuLinkConfiguration.php, line 74 - Definition of Drupal\configuration\Config\FieldConfiguration.
Class
Namespace
Drupal\configuration\ConfigCode
public static function getMenuLinkByIdenfifier($identifier, $reset = FALSE) {
static $menu_links;
if (!isset($menu_links) || $reset) {
$res = db_select('menu_links', 'ml')
->fields('ml', array(
'menu_name',
'link_path',
'mlid',
))
->execute()
->fetchAll();
$menu_links = array();
foreach ($res as $menu_link) {
$id = sha1(str_replace('-', '_', $menu_link->menu_name) . ':' . $menu_link->link_path);
$menu_links[$id] = $menu_link->mlid;
}
}
if (!empty($menu_links[$identifier])) {
return $menu_links[$identifier];
}
}