You are here

class WorkflowFieldConstraint in Workflow 8

Supports validating Workflow Field names.

@todo D8: CommentForm & constraints on Field. Show allowed field names.

Plugin annotation


@Constraint(
  id = "WorkflowField",
  label = @Translation("Workflow field name", context = "Validation"),
)

Hierarchy

Expanded class hierarchy of WorkflowFieldConstraint

See also

https://drupalwatchdog.com/volume-5/issue-2/introducing-drupal-8s-entity...

File

src/Plugin/Validation/Constraint/WorkflowFieldConstraint.php, line 19

Namespace

Drupal\workflow\Plugin\Validation\Constraint
View source
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',
    ];
  }

}

Members

Namesort descending Modifiers Type Description Overrides
WorkflowFieldConstraint::$messageFieldname public property Message shown when Comment fieldname does not match any Entity field name.
WorkflowFieldConstraint::coversFields public function An array of entity fields which should be passed to the validator. Overrides CompositeConstraintBase::coversFields