public function ChildOfMicrosite::evaluate in Entity Reference Hierarchy 3.x
Same name and namespace in other branches
- 8.2 modules/entity_hierarchy_microsite/src/Plugin/Condition/ChildOfMicrosite.php \Drupal\entity_hierarchy_microsite\Plugin\Condition\ChildOfMicrosite::evaluate()
Evaluates the condition and returns TRUE or FALSE accordingly.
Return value
bool TRUE if the condition has been met, FALSE otherwise.
Overrides ConditionInterface::evaluate
File
- modules/
entity_hierarchy_microsite/ src/ Plugin/ Condition/ ChildOfMicrosite.php, line 28
Class
- ChildOfMicrosite
- Defines a condition plugin to test if current page is child of microsite.
Namespace
Drupal\entity_hierarchy_microsite\Plugin\ConditionCode
public function evaluate() {
if (empty($this->configuration['field'])) {
return TRUE;
}
return ($node = $this
->getContextValue('node')) && $node instanceof NodeInterface && $this->childOfMicrositeLookup
->findMicrositesForNodeAndField($node, $this->configuration['field']);
}