function StaticMenuLinkOverrides::deleteMultipleOverrides

Same name in other branches
  1. 9 core/lib/Drupal/Core/Menu/StaticMenuLinkOverrides.php \Drupal\Core\Menu\StaticMenuLinkOverrides::deleteMultipleOverrides()
  2. 8.9.x core/lib/Drupal/Core/Menu/StaticMenuLinkOverrides.php \Drupal\Core\Menu\StaticMenuLinkOverrides::deleteMultipleOverrides()
  3. 11.x core/lib/Drupal/Core/Menu/StaticMenuLinkOverrides.php \Drupal\Core\Menu\StaticMenuLinkOverrides::deleteMultipleOverrides()
1 call to StaticMenuLinkOverrides::deleteMultipleOverrides()
StaticMenuLinkOverrides::deleteOverride in core/lib/Drupal/Core/Menu/StaticMenuLinkOverrides.php

File

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

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.