Skip to content
Snippets Groups Projects
Select Git revision
  • 9035805a124c2555ad88e34a06a978bc0906131a
  • 8.x-1.x default
  • 2.1.x
  • 2.0.x
  • 7.x-2.x
  • 7.x-1.x
  • 6.x-1.x
  • 6.x-2.x
  • 4.2.x-1.x
  • 4.5.x-1.x
  • 4.7.x-1.x
  • 5.x-1.x
  • 5.x-2.x
  • 2.1.6
  • 2.1.5
  • 2.1.4
  • 2.1.3
  • 2.1.2
  • 2.1.1
  • 2.1.0
  • 2.0.0
  • 8.1-1.8
  • 8.x-1.8
  • 8.x-1.7
  • 8.x-1.6
  • 8.x-1.5
  • 8.x-1.4
  • 8.x-1.3
  • 8.x-1.2
  • 7.x-2.13
  • 7.x-2.12
  • 8.x-1.1
  • 8.x-1.0
33 results

WorkflowFieldConstraint.php

Blame
  • John Voskuilen's avatar
    Issue #2919482: Clean code
    John Voskuilen authored
    9035805a
    History
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    WorkflowFieldConstraint.php 966 B
    <?php
    
    namespace Drupal\workflow\Plugin\Validation\Constraint;
    
    use Drupal\Core\Entity\Plugin\Validation\Constraint\CompositeConstraintBase;
    
    /**
     * Supports validating Workflow field names.
     *
     * @see https://drupalwatchdog.com/volume-5/issue-2/introducing-drupal-8s-entity-validation-api
     *
     * @todo D8: CommentForm & constraints on Field. Show allowed field names.
     *
     * @Constraint(
     *   id = "WorkflowField",
     *   label = @Translation("Workflow field name", context = "Validation"),
     * )
     */
    class WorkflowFieldConstraint extends CompositeConstraintBase {
    
      /**
       * Message shown when Comment fieldname does not match any Entity field name.
       *
       * @var string
       */
      public $messageFieldname = 'A workflow field on a comment must have
        the same field_name as the commented Entity. Please maintain the entity
        first, or choose another field name.';
    
      /**
       * {@inheritdoc}
       */
      public function coversFields() {
        return ['field_name'];
      }
    
    }