You are here

public function HasModeratedContentType::evaluate in Moderation Dashboard 2.0.x

Same name and namespace in other branches
  1. 8 src/Plugin/Condition/HasModeratedContentType.php \Drupal\moderation_dashboard\Plugin\Condition\HasModeratedContentType::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/HasModeratedContentType.php, line 118

Class

HasModeratedContentType
Provides a 'Has Moderated Content Type' condition.

Namespace

Drupal\moderation_dashboard\Plugin\Condition

Code

public function evaluate() {
  if (!$this->configuration['enable']) {
    return TRUE;
  }
  $entity_type = $this->entityTypeManager
    ->getDefinition('node');
  foreach ($this->bundleInfo
    ->getBundleInfo('node') as $bundle => $info) {
    if ($this->moderationInformation
      ->shouldModerateEntitiesOfBundle($entity_type, $bundle)) {
      return TRUE;
    }
  }
  return FALSE;
}