menuLinksRebuild example

$this->logger = \Drupal::service('logger.channel.menu');
    }
  }

  /** * Rebuilds the menu links and deletes the local_task cache tag. * * @param \Drupal\Component\EventDispatcher\Event $event * The event object. */
  public function onRouterRebuild($event) {
    $this->menuLinksRebuild();
    Cache::invalidateTags(['local_task']);
  }

  /** * Perform menu-specific rebuilding. */
  protected function menuLinksRebuild() {
    if ($this->lock->acquire(__FUNCTION__)) {
      try {
        $transaction = $this->connection->startTransaction();
        // Ensure the menu links are up to date.
Home | Imprint | This part of the site doesn't use cookies.