class UnpublishingIsEnabled in Scheduler 2.x
Same name and namespace in other branches
- 8 scheduler_rules_integration/src/Plugin/Condition/UnpublishingIsEnabled.php \Drupal\scheduler_rules_integration\Plugin\Condition\UnpublishingIsEnabled
Provides 'Unpublishing is enabled for the type of this entity' condition.
Plugin annotation
@Condition(
id = "scheduler_unpublishing_is_enabled",
deriver = "Drupal\scheduler_rules_integration\Plugin\Condition\ConditionDeriver"
)
Hierarchy
- class \Drupal\scheduler_rules_integration\Plugin\Condition\UnpublishingIsEnabled extends \Drupal\rules\Core\RulesConditionBase
Expanded class hierarchy of UnpublishingIsEnabled
1 file declares its use of UnpublishingIsEnabled
- LegacyUnpublishingIsEnabled.php in scheduler_rules_integration/
src/ Plugin/ Condition/ Legacy/ LegacyUnpublishingIsEnabled.php
File
- scheduler_rules_integration/
src/ Plugin/ Condition/ UnpublishingIsEnabled.php, line 16
Namespace
Drupal\scheduler_rules_integration\Plugin\ConditionView source
class UnpublishingIsEnabled extends RulesConditionBase {
/**
* Determines whether scheduled unpublishing is enabled for this entity type.
*
* @param \Drupal\Core\Entity\EntityInterface $entity
* The entity to be checked.
*
* @return bool
* TRUE if scheduled unpublishing is enabled for the bundle of this entity
* type.
*/
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'));
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
UnpublishingIsEnabled:: |
public | function | Determines whether scheduled unpublishing is enabled for this entity type. |