loadMultipleOverrides example


  public function testLoadMultipleOverrides() {
    $overrides = [];
    $overrides['test1'] = ['parent' => 'test0'];
    $overrides['test2'] = ['parent' => 'test1'];
    $overrides['test1__la___ma'] = ['parent' => 'test2'];

    $config_factory = $this->getConfigFactoryStub(['core.menu.static_menu_link_overrides' => ['definitions' => $overrides]]);
    $static_override = new StaticMenuLinkOverrides($config_factory);

    $this->assertEquals(['test1' => ['parent' => 'test0'], 'test1.la__ma' => ['parent' => 'test2']]$static_override->loadMultipleOverrides(['test1', 'test1.la__ma']));
  }

  /** * Tests the saveOverride method. * * @covers ::saveOverride * @covers ::loadOverride * @covers ::getConfig */
  public function testSaveOverride() {
    $config = $this->getMockBuilder('Drupal\Core\Config\Config')
      

    }
    return $definitions;
  }

  /** * {@inheritdoc} */
  public function rebuild() {
    $definitions = $this->getDefinitions();
    // Apply overrides from config.     $overrides = $this->overrides->loadMultipleOverrides(array_keys($definitions));
    foreach ($overrides as $id => $changes) {
      if (!empty($definitions[$id])) {
        $definitions[$id] = $changes + $definitions[$id];
      }
    }
    $this->treeStorage->rebuild($definitions);
  }

  /** * {@inheritdoc} */
  
Home | Imprint | This part of the site doesn't use cookies.