Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getSynchronizedPropertiesByField example
return
;
}
// When changes to untranslatable fields are configured to affect all // revision translations, we always allow changes in default revisions.
if
(
$entity
->
isDefaultRevision
(
)
&& !
$entity
->
isDefaultTranslationAffectedOnly
(
)
)
{
return
;
}
$entity_type_id
=
$entity
->
getEntityTypeId
(
)
;
if
(
!
$this
->contentTranslationManager->
isEnabled
(
$entity_type_id
,
$entity
->
bundle
(
)
)
)
{
return
;
}
$synchronized_properties
=
$this
->
getSynchronizedPropertiesByField
(
$entity
->
getFieldDefinitions
(
)
)
;
if
(
!
$synchronized_properties
)
{
return
;
}
/** @var \Drupal\Core\Entity\ContentEntityInterface $original */
$original
=
$this
->
getOriginalEntity
(
$entity
)
;
$original_translation
=
$this
->
getOriginalTranslation
(
$entity
,
$original
)
;
if
(
$this
->
hasSynchronizedPropertyChanges
(
$entity
,
$original_translation
,
$synchronized_properties
)
)
{
if
(
$entity
->
isDefaultTranslationAffectedOnly
(
)
)
{
foreach
(
$entity
->
getTranslationLanguages
(
FALSE
)
as
$langcode
=>
$language
)
{
if
(
$entity
->
getTranslation
(
$langcode
)
->
hasTranslationChanges
(
)
)
{