Skip to content
Snippets Groups Projects
Commit 0432cddf authored by George's avatar George Committed by Thomas Secher
Browse files

Issue #3299726 by geoanders: Taxonomy terms are not reset

parent 4a3bd7fb
No related branches found
No related tags found
1 merge request!4Issue #3299726 by geoanders: Taxonomy terms are not reset
......@@ -85,6 +85,8 @@ class EntityProcessorBase extends PluginBase implements EntityProcessorInterface
*
* @return bool|string
* The gid if exported, False either
*
* @throws \Drupal\Core\TypedData\Exception\MissingDataException
*/
final public function export(EntityInterface $entityToExport) {
// If entity is exportable (content entity).
......@@ -229,6 +231,8 @@ class EntityProcessorBase extends PluginBase implements EntityProcessorInterface
*
* @param array $dataToImport
* The data to import.
*
* @throws \Drupal\Core\TypedData\Exception\MissingDataException
*/
final public function import(array $dataToImport) {
$gid = $dataToImport[ExportEntityWriter::FIELD_GID];
......@@ -406,6 +410,8 @@ class EntityProcessorBase extends PluginBase implements EntityProcessorInterface
*
* @return array|bool
* The data to export.
*
* @throws \Drupal\Core\TypedData\Exception\MissingDataException
*/
public function getDataToExport(EntityInterface $entityToExport) {
$dataToExport = [];
......@@ -429,15 +435,13 @@ class EntityProcessorBase extends PluginBase implements EntityProcessorInterface
foreach ($entityToExport->getTypedData()
->getProperties() as $propertyId => $propertyData) {
// Check properties to export :
// Check properties to export:
if (!in_array($propertyId, $propertyIdsNotToExport)) {
/** @var \Drupal\content_synchronizer\Processors\Type\TypeProcessorBase $plugin */
if ($plugin = $this->getTypeProcessorManager()
->getInstanceByFieldType(get_class($propertyData))
) {
if ($fieldDataToExport = $plugin->getExportedData($entityToExport->get($propertyId))) {
$dataToExport[$propertyId] = $fieldDataToExport;
}
$dataToExport[$propertyId] = $plugin->getExportedData($entityToExport->get($propertyId));
}
}
}
......@@ -452,6 +456,8 @@ class EntityProcessorBase extends PluginBase implements EntityProcessorInterface
* The data to import.
* @param \Drupal\Core\Entity\EntityInterface $entityToImport
* The existing entity to update.
*
* @throws \Drupal\Core\TypedData\Exception\MissingDataException
*/
public function getEntityToImport(array $data, EntityInterface $entityToImport = NULL) {
if ($entityToImport) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment