You are here

public function TaxonomyVocabulary::evaluate in Context Breadcrumb 8

Evaluates the condition and returns TRUE or FALSE accordingly.

Return value

bool TRUE if the condition has been met, FALSE otherwise.

Throws

\Drupal\Component\Plugin\Exception\PluginException

Overrides ConditionInterface::evaluate

File

src/Plugin/Condition/TaxonomyVocabulary.php, line 131

Class

TaxonomyVocabulary
Provides a 'Taxonomy Vocabulary' condition.

Namespace

Drupal\context_breadcrumb\Plugin\Condition

Code

public function evaluate() {
  if (empty($this->configuration['vocabularies']) && !$this
    ->isNegated()) {
    return TRUE;
  }

  /** @var \Drupal\taxonomy\Entity\Term $term */
  if ($term = $this
    ->getContextValue('term')) {
    return !empty($this->configuration['vocabularies'][$term
      ->bundle()]);
  }
  return FALSE;
}