You are here

class PublishingIsEnabled in Scheduler 2.x

Same name and namespace in other branches
  1. 8 scheduler_rules_integration/src/Plugin/Condition/PublishingIsEnabled.php \Drupal\scheduler_rules_integration\Plugin\Condition\PublishingIsEnabled

Provides 'Publishing is enabled for the type of this entity' condition.

Plugin annotation


@Condition(
  id = "scheduler_publishing_is_enabled",
  deriver = "Drupal\scheduler_rules_integration\Plugin\Condition\ConditionDeriver"
)

Hierarchy

  • class \Drupal\scheduler_rules_integration\Plugin\Condition\PublishingIsEnabled extends \Drupal\rules\Core\RulesConditionBase

Expanded class hierarchy of PublishingIsEnabled

1 file declares its use of PublishingIsEnabled
LegacyPublishingIsEnabled.php in scheduler_rules_integration/src/Plugin/Condition/Legacy/LegacyPublishingIsEnabled.php

File

scheduler_rules_integration/src/Plugin/Condition/PublishingIsEnabled.php, line 16

Namespace

Drupal\scheduler_rules_integration\Plugin\Condition
View source
class PublishingIsEnabled extends RulesConditionBase {

  /**
   * Determines whether scheduled publishing is enabled for this entity type.
   *
   * @param \Drupal\Core\Entity\EntityInterface $entity
   *   The entity to be checked.
   *
   * @return bool
   *   TRUE if scheduled publishing 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', 'publish_enable', $config
      ->get('default_publish_enable'));
  }

}

Members

Namesort descending Modifiers Type Description Overrides
PublishingIsEnabled::doEvaluate public function Determines whether scheduled publishing is enabled for this entity type.