You are here

private function Taxonomy::convertParents in Workbench Access 8

Coverts the 0 parent id to a string.

Parameters

object $term: The term to modify.

string $id: The root parent id string.

1 call to Taxonomy::convertParents()
Taxonomy::buildTree in src/Plugin/AccessControlHierarchy/Taxonomy.php
Traverses the taxonomy tree and builds parentage arrays.

File

src/Plugin/AccessControlHierarchy/Taxonomy.php, line 175

Class

Taxonomy
Defines a hierarchy based on a Vocabulary.

Namespace

Drupal\workbench_access\Plugin\AccessControlHierarchy

Code

private function convertParents($term, $id) {
  foreach ($term->parents as $pos => $parent) {
    if ($parent === 0 || $parent === '0') {
      $term->parents[$pos] = $id;
    }
  }
  return $term->parents;
}