You are here

public function NodeTerms::__construct in Taxonomy Facets 8

File

src/NodeTerms.php, line 11

Class

NodeTerms

Namespace

Drupal\taxonomy_facets

Code

public function __construct($node) {

  // Load from this module settings and see which vocabularies need cascading.
  $config = \Drupal::config('taxonomy_facets.settings');
  $vocabularies = \Drupal\taxonomy\Entity\Vocabulary::loadMultiple();
  foreach ($vocabularies as $vocabulary) {

    // If setting is 1 deal with a vocabulary
    if ($config
      ->get($vocabulary
      ->id())) {
      $this->node = $node;
      if ($node
        ->id()) {
        $this->old_node = node_load($node
          ->id());
      }
      $this
        ->findFieldToCascadeTerms($vocabulary
        ->id());
    }
  }
}