You are here

class ScheduledDateProvidedConstraint in Sitewide Alert 8

Plugin implementation of the 'ScheduledDateProvided'.

Plugin annotation


@Constraint(
  id = "ScheduledDateProvided",
  label = @Translation("Scheduled date provided constraint", context = "Validation"),
  type = "entity:sitewide_alert"
)

Hierarchy

Expanded class hierarchy of ScheduledDateProvidedConstraint

File

src/Plugin/Validation/Constraint/ScheduledDateProvidedConstraint.php, line 17

Namespace

Drupal\sitewide_alert\Plugin\Validation\Constraint
View source
class ScheduledDateProvidedConstraint extends CompositeConstraintBase {

  /**
   * Message shown when the entity is marked as scheduled, but no scheduled date is provided.
   *
   * @var string
   */
  public $messageDatesNotProvided = 'This alert is marked as scheduled, but scheduled dates are not provided.';

  /**
   * An array of entity fields which should be passed to the validator.
   *
   * @return string[]
   *   An array of field names.
   */
  public function coversFields() {
    return [
      'scheduled_alert',
      'scheduled_date',
    ];
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ScheduledDateProvidedConstraint::$messageDatesNotProvided public property Message shown when the entity is marked as scheduled, but no scheduled date is provided.
ScheduledDateProvidedConstraint::coversFields public function An array of entity fields which should be passed to the validator. Overrides CompositeConstraintBase::coversFields