public function UnpublishingIsEnabled::doEvaluate in Scheduler 2.x
Determines whether scheduled unpublishing is enabled for this entity type.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity to be checked.
Return value
bool TRUE if scheduled unpublishing is enabled for the bundle of this entity type.
File
- scheduler_rules_integration/
src/ Plugin/ Condition/ UnpublishingIsEnabled.php, line 28
Class
- UnpublishingIsEnabled
- Provides 'Unpublishing is enabled for the type of this entity' condition.
Namespace
Drupal\scheduler_rules_integration\Plugin\ConditionCode
public function doEvaluate(EntityInterface $entity) {
$config = \Drupal::config('scheduler.settings');
$bundle_field = $entity
->getEntityType()
->get('entity_keys')['bundle'];
return $entity->{$bundle_field}->entity
->getThirdPartySetting('scheduler', 'unpublish_enable', $config
->get('default_unpublish_enable'));
}