deleteOverride example

$config_factory = $this->createMock('Drupal\Core\Config\ConfigFactoryInterface');
    $config_factory->expects($this->once())
      ->method('getEditable')
      ->willReturn($config);

    $static_override = new StaticMenuLinkOverrides($config_factory);

    if (is_array($ids)) {
      $static_override->deleteMultipleOverrides($ids);
    }
    else {
      $static_override->deleteOverride($ids);
    }
  }

  /** * Provides test data for testDeleteOverrides. */
  public function providerTestDeleteOverrides() {
    $data = [];
    // Delete a non existing ID.     $data[] = ['test0', [][]];
    // Delete an existing ID.

  protected function resetInstance(MenuLinkInterface $instance) {
    $id = $instance->getPluginId();

    if (!$instance->isResettable()) {
      throw new PluginException("Menu link $id is not resettable");
    }
    // Get the original data from disk, reset the override and re-save the menu     // tree for this link.     $definition = $this->getDefinitions()[$id];
    $this->overrides->deleteOverride($id);
    $this->treeStorage->save($definition);
    return $this->createInstance($id);
  }

  /** * {@inheritdoc} */
  public function resetDefinitions() {
    $this->treeStorage->resetDefinitions();
  }

}
Home | Imprint | This part of the site doesn't use cookies.