StaticMenuLinkOverrides::deleteMultipleOverrides

public StaticMenuLinkOverrides::deleteMultipleOverrides(array $ids)

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

Parameters

array $ids: Array of menu link plugin IDs.

Overrides StaticMenuLinkOverridesInterface::deleteMultipleOverrides

File

core/lib/Drupal/Core/Menu/StaticMenuLinkOverrides.php, line 82

Class

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

Namespace

Drupal\Core\Menu

Code

public function deleteMultipleOverrides(array $ids) {
  $all_overrides = $this->getConfig()->get('definitions');
  $save = FALSE;
  foreach ($ids as $id) {
    $id = static::encodeId($id);
    if (isset($all_overrides[$id])) {
      unset($all_overrides[$id]);
      $save = TRUE;
    }
  }
  if ($save) {
    $this->getConfig()->set('definitions', $all_overrides)->save();
  }
  return $save;
}
doc_Drupal
2016-10-29 09:44:21
Comments
Leave a Comment

Please login to continue.