public function PublishingIsEnabled::doEvaluate in Scheduler 2.x
Determines whether scheduled publishing is enabled for this entity type.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity to be checked.
Return value
bool TRUE if scheduled publishing is enabled for the bundle of this entity type.
File
- scheduler_rules_integration/
src/ Plugin/ Condition/ PublishingIsEnabled.php, line 28
Class
- PublishingIsEnabled
- Provides 'Publishing 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', 'publish_enable', $config
->get('default_publish_enable'));
}