ContentTranslationSynchronizedFieldsConstraintValidator
class ContentTranslationSynchronizedFieldsConstraintValidator extends ConstraintValidator implements ContainerInjectionInterface (View source)
| internal |
Checks that synchronized fields are handled correctly in pending revisions.
As for untranslatable fields, two modes are supported:
- When changes to untranslatable fields are configured to affect all revision translations, synchronized field properties can be changed only in default revisions.
- When changes to untranslatable fields affect are configured to affect only the revision's default translation, synchronized field properties can be changed only when editing the default translation. This may lead to temporarily desynchronized values, when saving a pending revision for the default translation that changes a synchronized property. These are actually synchronized when saving changes to the default translation as a new default revision.
Properties
| protected EntityTypeManagerInterface | $entityTypeManager | The entity type manager. |
|
| protected ContentTranslationManagerInterface | $contentTranslationManager | The content translation manager. |
|
| protected FieldTranslationSynchronizerInterface | $synchronizer | The field translation synchronizer. |
Methods
ContentTranslationSynchronizedFieldsConstraintValidator constructor.
Instantiates a new instance of this class.
{@inheritdoc}
Checks whether any synchronized property has changes.
Returns the original unchanged entity to be used to detect changes.
Returns the original translation.
Returns the synchronized properties for every specified field.
Details
__construct(EntityTypeManagerInterface $entity_type_manager, ContentTranslationManagerInterface $content_translation_manager, FieldTranslationSynchronizerInterface $synchronizer)
ContentTranslationSynchronizedFieldsConstraintValidator constructor.
static
create(ContainerInterface $container)
Instantiates a new instance of this class.
This is a factory method that returns a new instance of this class. The factory should pass any needed dependencies into the constructor of this class, but not the container itself. Every call to this method must return a new instance of this class; that is, it may not implement a singleton.
validate($value, Constraint $constraint)
{@inheritdoc}
protected bool
hasSynchronizedPropertyChanges(ContentEntityInterface $entity, ContentEntityInterface $original, array $synchronized_properties)
Checks whether any synchronized property has changes.
protected ContentEntityInterface
getOriginalEntity(ContentEntityInterface $entity)
Returns the original unchanged entity to be used to detect changes.
protected ContentEntityInterface
getOriginalTranslation(ContentEntityInterface $entity, ContentEntityInterface $original)
Returns the original translation.
string[][]
getSynchronizedPropertiesByField(array $field_definitions)
Returns the synchronized properties for every specified field.