public function AutoBlockScheduler::evaluate in Auto Block Scheduler 8
Same name and namespace in other branches
- 8.2 src/Plugin/Condition/AutoBlockScheduler.php \Drupal\auto_block_scheduler\Plugin\Condition\AutoBlockScheduler::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/ AutoBlockScheduler.php, line 89 - Contains \Drupal\block_scheduler\Plugin\Condition\Expiry.
Class
- AutoBlockScheduler
- Provides a 'AutoBlockScheduler ' condition.
Namespace
Drupal\auto_block_scheduler\Plugin\ConditionCode
public function evaluate() {
$status = TRUE;
if (empty($this->configuration['published_on']) && empty($this->configuration['unpublished_on']) && !$this
->isNegated()) {
return TRUE;
}
if (!empty($this->configuration['published_on'])) {
$status = $status && time() >= $this->configuration['published_on'];
}
if (!empty($this->configuration['unpublished_on'])) {
$status = $status && time() <= $this->configuration['unpublished_on'];
}
return $status;
}