class EntityUntranslatableFieldsConstraintValidator extends ConstraintValidator implements ContainerInjectionInterface (View source)

Validates the EntityChanged constraint.

Traits

Provides helper methods to detect changes in an entity object.

Properties

protected EntityTypeManagerInterface $entityTypeManager

The entity type manager.

Methods

string[]
getFieldsToSkipFromTranslationChangesCheck(ContentEntityInterface $entity)

Returns an array of field names to skip when checking for changes.

__construct(EntityTypeManagerInterface $entity_type_manager)

Constructs an EntityUntranslatableFieldsConstraintValidator object.

static 
create(ContainerInterface $container)

Instantiates a new instance of this class.

validate($entity, Constraint $constraint)

{@inheritdoc}

bool
hasUntranslatableFieldsChanges(ContentEntityInterface $entity)

Checks whether an entity has untranslatable field changes.

Details

protected string[] getFieldsToSkipFromTranslationChangesCheck(ContentEntityInterface $entity)

Returns an array of field names to skip when checking for changes.

Parameters

ContentEntityInterface $entity

A content entity object.

Return Value

string[]

An array of field names.

__construct(EntityTypeManagerInterface $entity_type_manager)

Constructs an EntityUntranslatableFieldsConstraintValidator object.

Parameters

EntityTypeManagerInterface $entity_type_manager

The entity type manager.

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.

Parameters

ContainerInterface $container

The service container this instance should use.

validate($entity, Constraint $constraint)

{@inheritdoc}

Parameters

$entity
Constraint $constraint

protected bool hasUntranslatableFieldsChanges(ContentEntityInterface $entity)

Checks whether an entity has untranslatable field changes.

Parameters

ContentEntityInterface $entity

A content entity object.

Return Value

bool

TRUE if untranslatable fields have changes, FALSE otherwise.