You are here

protected function MongodbMenuTreeStorage::setParents in MongoDB 8

Sets the materialized path field values based on the parent.

Parameters

array $fields: The menu link.

array|false $parent: The parent menu link.

array $original: The original menu link.

Overrides MenuTreeStorage::setParents

File

src/MongodbMenuTreeStorage.php, line 181
Contains \Drupal\mongodb\MongodbMenuTreeStorage .

Class

MongodbMenuTreeStorage

Namespace

Drupal\mongodb

Code

protected function setParents(array &$fields, $parent, array $original) {
  if ($parent) {
    $fields['depth'] = $parent['depth'] + 1;
    $prefix = $parent['p'];
  }
  else {
    $fields['depth'] = 1;
    $prefix = '';
  }
  $fields['p'] = $prefix . $this
    ->encode128($fields['mlid']);
}