You are here

class UnpublishNow in Scheduler 2.x

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

Provides an 'Unpublish immediately' action.

Plugin annotation


@RulesAction(
  id = "scheduler_unpublish_now",
  deriver = "Drupal\scheduler_rules_integration\Plugin\RulesAction\SchedulerRulesActionDeriver"
)

Hierarchy

  • class \Drupal\scheduler_rules_integration\Plugin\RulesAction\SchedulerRulesActionBase extends \Drupal\rules\Core\RulesActionBase
    • class \Drupal\scheduler_rules_integration\Plugin\RulesAction\UnpublishNow

Expanded class hierarchy of UnpublishNow

1 file declares its use of UnpublishNow
LegacyUnpublishNow.php in scheduler_rules_integration/src/Plugin/RulesAction/Legacy/LegacyUnpublishNow.php

File

scheduler_rules_integration/src/Plugin/RulesAction/UnpublishNow.php, line 15

Namespace

Drupal\scheduler_rules_integration\Plugin\RulesAction
View source
class UnpublishNow extends SchedulerRulesActionBase {

  /**
   * Set the entity status to Unpublished.
   *
   * This action is provided by the Rules Module but only for node content, not
   * Media. There is also a problem with recursion in the Rules action due to
   * autoSaveContext(). Hence better for Scheduler to provide this action.
   *
   * @param \Drupal\Core\Entity\EntityInterface $entity
   *   The entity to be unpublished.
   */
  public function doExecute(EntityInterface $entity) {
    $entity
      ->setUnpublished();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
SchedulerRulesActionBase::$entityTypeId protected property The entity type id.
SchedulerRulesActionBase::create public static function
SchedulerRulesActionBase::notEnabledWarning public function Gives a warning when an entity is not enabled for Scheduler.
SchedulerRulesActionBase::__construct public function Constructs a SchedulerRulesActionBase object.
UnpublishNow::doExecute public function Set the entity status to Unpublished.