class BlockContentEntityChangedConstraintValidator
Same name in other branches
- 10 core/modules/block_content/src/Plugin/Validation/Constraint/BlockContentEntityChangedConstraintValidator.php \Drupal\block_content\Plugin\Validation\Constraint\BlockContentEntityChangedConstraintValidator
- 11.x core/modules/block_content/src/Plugin/Validation/Constraint/BlockContentEntityChangedConstraintValidator.php \Drupal\block_content\Plugin\Validation\Constraint\BlockContentEntityChangedConstraintValidator
Validates the BlockContentEntityChanged constraint.
Hierarchy
- class \Drupal\Core\Entity\Plugin\Validation\Constraint\EntityChangedConstraintValidator extends \Symfony\Component\Validator\ConstraintValidator
- class \Drupal\block_content\Plugin\Validation\Constraint\BlockContentEntityChangedConstraintValidator extends \Drupal\Core\Entity\Plugin\Validation\Constraint\EntityChangedConstraintValidator
Expanded class hierarchy of BlockContentEntityChangedConstraintValidator
File
-
core/
modules/ block_content/ src/ Plugin/ Validation/ Constraint/ BlockContentEntityChangedConstraintValidator.php, line 12
Namespace
Drupal\block_content\Plugin\Validation\ConstraintView source
class BlockContentEntityChangedConstraintValidator extends EntityChangedConstraintValidator {
/**
* {@inheritdoc}
*/
public function validate($entity, Constraint $constraint) {
// This prevents saving an update to the block via a host entity's form if
// the host entity has had other changes made via the API instead of the
// entity form, such as a revision revert. This is safe, for example, in the
// Layout Builder the inline blocks are not saved until the whole layout is
// saved, in which case Layout Builder forces a new revision for the block.
// @see \Drupal\layout_builder\InlineBlockEntityOperations::handlePreSave.
if ($entity instanceof BlockContentInterface && !$entity->isReusable()) {
return;
}
parent::validate($entity, $constraint);
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title |
---|---|---|---|---|
BlockContentEntityChangedConstraintValidator::validate | public | function | Overrides EntityChangedConstraintValidator::validate |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.