You are here

class SchedulerUnpublishOnConstraint in Scheduler 8

Same name and namespace in other branches
  1. 2.x src/Plugin/Validation/Constraint/SchedulerUnpublishOnConstraint.php \Drupal\scheduler\Plugin\Validation\Constraint\SchedulerUnpublishOnConstraint

Validates unpublish on values.

Plugin annotation


@Constraint(
  id = "SchedulerUnpublishOn",
  label = @Translation("Scheduler unpublish on", context = "Validation"),
  type = "entity:node"
)

Hierarchy

Expanded class hierarchy of SchedulerUnpublishOnConstraint

File

src/Plugin/Validation/Constraint/SchedulerUnpublishOnConstraint.php, line 16

Namespace

Drupal\scheduler\Plugin\Validation\Constraint
View source
class SchedulerUnpublishOnConstraint extends CompositeConstraintBase {

  /**
   * Message shown when unpublish_on is missing but publish_on has been entered.
   *
   * @var string
   */
  public $messageUnpublishOnRequiredIfPublishOnEntered = "If you set a 'publish on' date then you must also set an 'unpublish on' date.";

  /**
   * Message shown when unpublish_on is missing but node is published directly.
   *
   * @var string
   */
  public $messageUnpublishOnRequiredIfPublishing = "Either you must set an 'unpublish on' date or save this node as unpublished.";

  /**
   * Message shown when unpublish_on is not in the future.
   *
   * @var string
   */
  public $messageUnpublishOnDateNotInFuture = "The 'unpublish on' date must be in the future.";

  /**
   * Message shown when unpublish date is not later than the publish date.
   *
   * @var string
   */
  public $messageUnpublishOnTooEarly = "The 'unpublish on' date must be later than the 'publish on' date.";

  /**
   * {@inheritdoc}
   */
  public function coversFields() {
    return [
      'unpublish_on',
    ];
  }

}

Members

Namesort descending Modifiers Type Description Overrides
SchedulerUnpublishOnConstraint::$messageUnpublishOnDateNotInFuture public property Message shown when unpublish_on is not in the future.
SchedulerUnpublishOnConstraint::$messageUnpublishOnRequiredIfPublishing public property Message shown when unpublish_on is missing but node is published directly.
SchedulerUnpublishOnConstraint::$messageUnpublishOnRequiredIfPublishOnEntered public property Message shown when unpublish_on is missing but publish_on has been entered.
SchedulerUnpublishOnConstraint::$messageUnpublishOnTooEarly public property Message shown when unpublish date is not later than the publish date.
SchedulerUnpublishOnConstraint::coversFields public function An array of entity fields which should be passed to the validator. Overrides CompositeConstraintBase::coversFields