public function StaticMenuLinkOverrides::loadMultipleOverrides in Drupal 9
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Menu/StaticMenuLinkOverrides.php \Drupal\Core\Menu\StaticMenuLinkOverrides::loadMultipleOverrides()
- 10 core/lib/Drupal/Core/Menu/StaticMenuLinkOverrides.php \Drupal\Core\Menu\StaticMenuLinkOverrides::loadMultipleOverrides()
Loads overrides to multiple definitions of a static (YAML-defined) link.
Parameters
array $ids: Array of menu link plugin IDs.
Return value
array One or override keys by plugin ID.
Overrides StaticMenuLinkOverridesInterface::loadMultipleOverrides
See also
\Drupal\Core\Menu\StaticMenuLinkOverridesInterface
File
- core/
lib/ Drupal/ Core/ Menu/ StaticMenuLinkOverrides.php, line 108
Class
- StaticMenuLinkOverrides
- Defines an implementation of the menu link override using a config file.
Namespace
Drupal\Core\MenuCode
public function loadMultipleOverrides(array $ids) {
$result = [];
if ($ids) {
$all_overrides = $this
->getConfig()
->get('definitions') ?: [];
foreach ($ids as $id) {
$encoded_id = static::encodeId($id);
if (isset($all_overrides[$encoded_id])) {
$result[$id] = $all_overrides[$encoded_id];
}
}
}
return $result;
}