// a pending revision. This is needed so validation constraints like
// \Drupal\path\Plugin\Validation\Constraint\PathAliasConstraintValidator
// know in advance (before hook_entity_presave()) that the new revision will
// be a pending one.
if ($this->workspaceManager->
hasActiveWorkspace()) { $form['#entity_builders'
][] =
[static::
class, 'entityFormEntityBuild'
];
} // Run the workspace conflict validation constraint when the entity form is
// being built so we can "disable" it early and display a message to the
// user, instead of allowing them to enter data that can never be saved.
foreach ($entity->
validate()->
getEntityViolations() as $violation) { if ($violation->
getConstraint() instanceof EntityWorkspaceConflictConstraint
) { $form['#markup'
] =
$violation->
getMessage();
$form['#access'
] = FALSE;
continue;
} } } /**
* Entity builder that marks all supported entities as pending revisions.
*/