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
- class \Drupal\Core\Entity\Plugin\Validation\Constraint\CompositeConstraintBase extends \Symfony\Component\Validator\Constraint
- class \Drupal\workflow\Plugin\Validation\Constraint\WorkflowFieldConstraint
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\ConstraintView 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
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
WorkflowFieldConstraint:: |
public | property | Message shown when Comment fieldname does not match any Entity field name. | |
WorkflowFieldConstraint:: |
public | function |
An array of entity fields which should be passed to the validator. Overrides CompositeConstraintBase:: |