public function GroupType::evaluate in Group 8
Same name and namespace in other branches
- 2.0.x src/Plugin/Condition/GroupType.php \Drupal\group\Plugin\Condition\GroupType::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
- src/
Plugin/ Condition/ GroupType.php, line 115
Class
- GroupType
- Provides a 'Group Type' condition.
Namespace
Drupal\group\Plugin\ConditionCode
public function evaluate() {
// If there are no group types selected and the condition is not negated, we
// return TRUE because it means all group types are valid.
if (empty($this->configuration['group_types']) && !$this
->isNegated()) {
return TRUE;
}
// Check if the group type of the group context was selected.
$group = $this
->getContextValue('group');
return !empty($this->configuration['group_types'][$group
->bundle()]);
}