You are here

protected function Tracker::setTrackedEntityTypes in Menu Entity Index 8

Sets entity types to track and updates database table accordingly.

Parameters

array $entity_type_ids: Entity Type Ids to track.

1 call to Tracker::setTrackedEntityTypes()
Tracker::setConfiguration in src/Tracker.php
Sets configuration values and triggers rescanning of menus as needed.

File

src/Tracker.php, line 314

Class

Tracker
Tracks menu links and their referenced entities.

Namespace

Drupal\menu_entity_index

Code

protected function setTrackedEntityTypes(array $entity_type_ids = []) {
  $values = $this->config
    ->get('entity_types');
  $this->configFactory
    ->getEditable('menu_entity_index.configuration')
    ->set('entity_types', $entity_type_ids)
    ->save();
  $this->config = $this->configFactory
    ->get('menu_entity_index.configuration');
  $this
    ->untrackEntityTypeIds((array) array_diff($values, $entity_type_ids));
  $new_types = (array) array_diff($entity_type_ids, $values);
  return count($new_types) > 0;
}