You are here

protected function Tracker::trackMenus in Menu Entity Index 8

Scans menu links in menus for references to target entities via Batch API.

Parameters

array $menus: Menu names to scan.

2 calls to Tracker::trackMenus()
Tracker::setTrackAllMenus in src/Tracker.php
Sets all menus option to track and update database table accordingly.
Tracker::setTrackedMenus in src/Tracker.php
Sets menus to track and updates database table accordingly.

File

src/Tracker.php, line 329

Class

Tracker
Tracks menu links and their referenced entities.

Namespace

Drupal\menu_entity_index

Code

protected function trackMenus(array $menus = []) {
  if (empty($menus)) {
    return;
  }
  $operations = [];
  foreach ($menus as $menu) {
    $arguments = [
      [
        $menu,
      ],
    ];
    $operations[] = [
      'menu_entity_index_track_batch',
      $arguments,
    ];
  }
  batch_set([
    'title' => $this
      ->t('Scanning menu links'),
    'operations' => $operations,
    'file' => drupal_get_path('module', 'menu_entity_index') . '/menu_entity_index.batch.inc',
  ]);
}