Skip to content
Snippets Groups Projects
Commit 265685e3 authored by Antonio Savorelli's avatar Antonio Savorelli Committed by Antonio Savorelli
Browse files

Issue #3245315: Add __get() method to LingotekContentTranslationService.

parent 3c05a9a6
No related branches found
No related tags found
2 merge requests!13Draft: DO NOT MERGE: use to revert to previous patch for 3245315,!12Draft: DO NOT MERGE: use to revert to previous patch for 3245315
......@@ -10,14 +10,6 @@ use Drupal\lingotek\LingotekContentTranslationServiceInterface as BaseLingotekCo
*/
interface LingotekContentTranslationServiceInterface extends BaseLingotekContentTranslationServiceInterface {
/**
* Returns the entity-field manager.
*
* @return \Drupal\Core\Entity\EntityFieldManagerInterface
* The entity_field.manager service.
*/
public function entityFieldManager();
/**
* Public wrapper for ::includeMetadata().
*
......
......@@ -26,6 +26,7 @@ use Drupal\lingotek\LingotekContentTranslationService as BaseLingotekContentTran
use Drupal\lingotek\LingotekConfigTranslationServiceInterface;
use Drupal\lingotek_overrides\LingotekInterface;
use Drupal\node\NodeInterface;
use InvalidArgumentException;
/**
* Decorates the lingotek.content_translation service.
......@@ -80,6 +81,24 @@ class LingotekContentTranslationService extends BaseLingotekContentTranslationSe
$this->sourcePluginManager = $source_plugin_manager;
}
/**
* Magic getter.
*
* @param string $key
* The property name.
*
* @return mixed
* The property value.
*
*/
public function __get(string $key) {
if (property_exists($this, $key)) {
return $this->{$key};
}
throw new InvalidArgumentException("The requested property '$key' does not exist.");
}
/**
* {@inheritdoc}
*/
......@@ -698,13 +717,6 @@ class LingotekContentTranslationService extends BaseLingotekContentTranslationSe
}
}
/**
* {@inheritDoc}
*/
public function entityFieldManager() {
return $this->entityFieldManager;
}
/**
* {@inheritDoc}
*/
......
......@@ -86,7 +86,7 @@ abstract class SourceBase extends PluginBase implements SourceInterface {
module_load_include('inc', 'content_translation', 'content_translation.admin');
$column_element = content_translation_field_sync_widget($field_definition);
$entity_type = $entity->getEntityType();
$storage_definitions = $entity_type instanceof ContentEntityTypeInterface ? $translation_service->entityFieldManager()->getFieldStorageDefinitions($entity_type->id()) : [];
$storage_definitions = $entity_type instanceof ContentEntityTypeInterface ? $translation_service->entityFieldManager->getFieldStorageDefinitions($entity_type->id()) : [];
foreach ($field as $fkey => $fval) {
// If we have only one relevant column, upload that. If not, check our
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment