diff --git a/src/Configuration.php b/src/Configuration.php index a10a057c..9b83cdd2 100644 --- a/src/Configuration.php +++ b/src/Configuration.php @@ -80,7 +80,7 @@ public function __construct($type, $path, $name = null, $configuration = null) $this->setType($type); $this->setPath($path); $this->setName($name); - $this->setConfiguration($configuration ?? []); + $this->setConfiguration($configuration); } public function getObjectVars(): array @@ -148,12 +148,10 @@ public function setType(string $type): void */ public function setConfiguration($configuration): void { - if (is_array($configuration)) { - $configuration = json_decode(json_encode($configuration), true); - } - if (empty($this->getName())) { + if ($configuration && empty($this->getName())) { $this->setName($configuration['configuration']['general']['name'] ?? null); } + $this->configuration = $configuration; } diff --git a/src/Event/GraphQL/AssetMetadataEvents.php b/src/Event/GraphQL/AssetMetadataEvents.php new file mode 100644 index 00000000..d4b1e896 --- /dev/null +++ b/src/Event/GraphQL/AssetMetadataEvents.php @@ -0,0 +1,26 @@ +getAssetFromValue($value, $context); + $metadata = $asset?->getMetadata(raw: true); + if (!$metadata) { + return null; + } - if ($asset) { - $metadata = $asset->getObjectVar('metadata'); - if ($metadata) { - if (isset($args['ignore_language']) && $args['ignore_language']) { - return $metadata; - } + //Relational data would return as a comma separated list. each element type and id by `_`, eg. "object_154,asset_489" + $event = new AssetEvent($asset, [ + 'metadata' => $metadata, + 'context' => $context + ]); + /** @var EventDispatcher $eventDispatcher */ + $eventDispatcher = \Pimcore::getContainer()->get('event_dispatcher'); + $eventDispatcher->dispatch($event, AssetMetadataEvents::PRE_RESOLVE); + $metadata = $event->getArgument('metadata'); + + if (isset($args['ignore_language']) && $args['ignore_language']) { + return $metadata; + } - $map = []; - $keys = []; - $language = isset($args['language']) ? $args['language'] : $this->getGraphQlService()->getLocaleService()->findLocale(); + $map = []; + $keys = []; + $language = $args['language'] ?? $this->getGraphQlService()->getLocaleService()->findLocale(); - foreach ($metadata as $item) { - $keys[$item['name']] = 1; - $l = $item['language'] ? $item['language'] : 'default'; - $map[$l][$item['name']] = $item; - } - $result = []; - - foreach ($keys as $key => $found) { - if (isset($map[$language][$key])) { - $result[] = $map[$language][$key]; - } elseif (isset($map['default'][$key])) { - $result[] = $map['default'][$key]; - } - } + foreach ($metadata as $item) { + $keys[$item['name']] = 1; + $l = $item['language'] ?: 'default'; + $map[$l][$item['name']] = $item; + } + $result = []; - if ($result) { - return $result; - } + foreach ($keys as $key => $found) { + if (isset($map[$language][$key])) { + $result[] = $map[$language][$key]; + } elseif (isset($map['default'][$key])) { + $result[] = $map['default'][$key]; } } + if ($result) { + return $result; + } + return null; } diff --git a/src/Resources/translations/admin.ca.yml b/src/Resources/translations/admin.ca.yml index 24bb548d..3a3e1e3b 100644 --- a/src/Resources/translations/admin.ca.yml +++ b/src/Resources/translations/admin.ca.yml @@ -1,5 +1,5 @@ --- -plugin_pimcore_datahub_toolbar: Datahub +plugin_pimcore_datahub_toolbar: Datahub Config plugin_pimcore_datahub_configpanel_add: Add Configuration plugin_pimcore_datahub_configpanel_enterkey_title: Add a new configuration plugin_pimcore_datahub_configpanel_enterkey_prompt: Unique Identifier diff --git a/src/Resources/translations/admin.cs.yml b/src/Resources/translations/admin.cs.yml index 24bb548d..3a3e1e3b 100644 --- a/src/Resources/translations/admin.cs.yml +++ b/src/Resources/translations/admin.cs.yml @@ -1,5 +1,5 @@ --- -plugin_pimcore_datahub_toolbar: Datahub +plugin_pimcore_datahub_toolbar: Datahub Config plugin_pimcore_datahub_configpanel_add: Add Configuration plugin_pimcore_datahub_configpanel_enterkey_title: Add a new configuration plugin_pimcore_datahub_configpanel_enterkey_prompt: Unique Identifier diff --git a/src/Resources/translations/admin.es.yml b/src/Resources/translations/admin.es.yml index 24bb548d..3a3e1e3b 100644 --- a/src/Resources/translations/admin.es.yml +++ b/src/Resources/translations/admin.es.yml @@ -1,5 +1,5 @@ --- -plugin_pimcore_datahub_toolbar: Datahub +plugin_pimcore_datahub_toolbar: Datahub Config plugin_pimcore_datahub_configpanel_add: Add Configuration plugin_pimcore_datahub_configpanel_enterkey_title: Add a new configuration plugin_pimcore_datahub_configpanel_enterkey_prompt: Unique Identifier diff --git a/src/Resources/translations/admin.hu.yml b/src/Resources/translations/admin.hu.yml index 24bb548d..3a3e1e3b 100644 --- a/src/Resources/translations/admin.hu.yml +++ b/src/Resources/translations/admin.hu.yml @@ -1,5 +1,5 @@ --- -plugin_pimcore_datahub_toolbar: Datahub +plugin_pimcore_datahub_toolbar: Datahub Config plugin_pimcore_datahub_configpanel_add: Add Configuration plugin_pimcore_datahub_configpanel_enterkey_title: Add a new configuration plugin_pimcore_datahub_configpanel_enterkey_prompt: Unique Identifier diff --git a/src/Resources/translations/admin.it.yml b/src/Resources/translations/admin.it.yml index 24bb548d..3a3e1e3b 100644 --- a/src/Resources/translations/admin.it.yml +++ b/src/Resources/translations/admin.it.yml @@ -1,5 +1,5 @@ --- -plugin_pimcore_datahub_toolbar: Datahub +plugin_pimcore_datahub_toolbar: Datahub Config plugin_pimcore_datahub_configpanel_add: Add Configuration plugin_pimcore_datahub_configpanel_enterkey_title: Add a new configuration plugin_pimcore_datahub_configpanel_enterkey_prompt: Unique Identifier diff --git a/src/Resources/translations/admin.nl.yml b/src/Resources/translations/admin.nl.yml index 24bb548d..3a3e1e3b 100644 --- a/src/Resources/translations/admin.nl.yml +++ b/src/Resources/translations/admin.nl.yml @@ -1,5 +1,5 @@ --- -plugin_pimcore_datahub_toolbar: Datahub +plugin_pimcore_datahub_toolbar: Datahub Config plugin_pimcore_datahub_configpanel_add: Add Configuration plugin_pimcore_datahub_configpanel_enterkey_title: Add a new configuration plugin_pimcore_datahub_configpanel_enterkey_prompt: Unique Identifier diff --git a/src/Resources/translations/admin.pl.yml b/src/Resources/translations/admin.pl.yml index 24bb548d..3a3e1e3b 100644 --- a/src/Resources/translations/admin.pl.yml +++ b/src/Resources/translations/admin.pl.yml @@ -1,5 +1,5 @@ --- -plugin_pimcore_datahub_toolbar: Datahub +plugin_pimcore_datahub_toolbar: Datahub Config plugin_pimcore_datahub_configpanel_add: Add Configuration plugin_pimcore_datahub_configpanel_enterkey_title: Add a new configuration plugin_pimcore_datahub_configpanel_enterkey_prompt: Unique Identifier diff --git a/src/Resources/translations/admin.pt_br.yml b/src/Resources/translations/admin.pt_br.yml index 24bb548d..3a3e1e3b 100644 --- a/src/Resources/translations/admin.pt_br.yml +++ b/src/Resources/translations/admin.pt_br.yml @@ -1,5 +1,5 @@ --- -plugin_pimcore_datahub_toolbar: Datahub +plugin_pimcore_datahub_toolbar: Datahub Config plugin_pimcore_datahub_configpanel_add: Add Configuration plugin_pimcore_datahub_configpanel_enterkey_title: Add a new configuration plugin_pimcore_datahub_configpanel_enterkey_prompt: Unique Identifier diff --git a/src/Resources/translations/admin.ro.yml b/src/Resources/translations/admin.ro.yml new file mode 100644 index 00000000..3a3e1e3b --- /dev/null +++ b/src/Resources/translations/admin.ro.yml @@ -0,0 +1,99 @@ +--- +plugin_pimcore_datahub_toolbar: Datahub Config +plugin_pimcore_datahub_configpanel_add: Add Configuration +plugin_pimcore_datahub_configpanel_enterkey_title: Add a new configuration +plugin_pimcore_datahub_configpanel_enterkey_prompt: Unique Identifier +plugin_pimcore_datahub_configpanel_error_adding_config: Error adding configuration +plugin_pimcore_datahub_configpanel: Configuration +plugin_pimcore_datahub_configpanel_invalid_name: Invalid name +plugin_pimcore_datahub_configpanel_invalid_length: Exceeded maximum configuration + name length 80 of characters +plugin_pimcore_datahub_configpanel_error_cloning_config: Error cloning configuration +plugin_pimcore_datahub_configpanel_enterclonekey_title: Clone +plugin_pimcore_datahub_configpanel_enterclonekey_enterclonekey_prompt: Name of clone +plugin_pimcore_datahub_configpanel_item_save_success: Configuration saved +plugin_pimcore_datahub_configpanel_item_saveerror: Configuration could not be saved +plugin_pimcore_datahub_configpanel_item_saveerror_permissions: Configuration cannot + be saved because it would deprive your update permissions. Please check the permissions + tab. +plugin_pimcore_datahub_configpanel_item_general: General +plugin_pimcore_datahub_configpanel_sqlObjectCondition: SQL Condition +plugin_pimcore_datahub_configpanel_schema: Schema Definition +plugin_pimcore_datahub_configpanel_schema_fields: Schema Fields +plugin_pimcore_datahub_configpanel_security: Security Definition +plugin_pimcore_datahub_configpanel_security_method: Method +plugin_pimcore_datahub_configpanel_security_method_apikey: API Key +plugin_pimcore_datahub_configpanel_fields: Fields +plugin_pimcore_datahub_configpanel_entity: Entity +plugin_pimcore_datahub_configpanel_root: Root Node +plugin_pimcore_datahub_fieldName: Field Name +plugin_pimcore_datahub_configpanel_condition_hint: This is a global SQL condition + in addition to the workspace settings that will be added to all queries +plugin_pimcore_datahub_configpanel_available_fields: Available Fields +plugin_pimcore_datahub_operator_thumbnail_config: Configuration +plugin_pimcore_datahub_operator_select_entity: Select Entity +plugin_pimcore_datahub_security_datahub_apikey: Datahub API Keys +plugin_pimcore_datahub_security_definition: Security Definition +plugin_pimcore_datahub_security_apikey_description: API key required for web service + access. One API key per line allowed. At least one key with minimum 16 characters + needs to be provided. +plugin_pimcore_datahub_config: Datahub Config +plugin_datahub_config: Datahub Config +plugin_datahub_adapter_graphql: Datahub Adapter - GraphQL +plugin_datahub_admin: Datahub Admin +plugin_pimcore_datahub_type_graphql: GraphQL +plugin_pimcore_datahub_workspace_permission_create: Create +plugin_pimcore_datahub_workspace_permission_read: Read +plugin_pimcore_datahub_workspace_permission_update: Update +plugin_pimcore_datahub_workspace_permission_delete: Delete +plugin_pimcore_datahub_graphql_open_explorer_in_iframe: Open in Iframe +plugin_pimcore_datahub_graphql_open_explorer_in_tab: Open in Tab +plugin_pimcore_datahub_graphql_query_schema: Query Schema +plugin_pimcore_datahub_graphql_mutation_schema: Mutation Schema +plugin_pimcore_datahub_graphql_iexplorer: iExplorer +plugin_pimcore_datahub_datatype_not_supported_yet: datatype '%s' not supported yet +operator_alias: Alias +operator_concatenator: Operator Concatenator +operator_dateformatter: Date Formatter +operator_element_counter: Element Counter +operator_text: Operator Text +operator_merge: Merge (deprecated) +operator_substring: Substring +operator_thumbnail: Thumbnail +operator_thumbnail_html: Thumbnail HTML +operator_translate_value: Operator Translate Value +operator_trimmer: Trimmer +mutationoperator_locale_switcher: Locale Switcher +mutationoperator_ifempty: IfEmpty +mutationoperator_locale_collector: Locale Collector +mutationoperator_locale_switcher_description: Switches to different language other + than the default language. +mutationoperator_ifempty_description: Only sets the value if current one is empty. +mutationoperator_locale_collector_description: Allows editing all languages for a + single field. +plugin_pimcore_datahub_query: Query +plugin_pimcore_datahub_mutation: Mutation +plugin_pimcore_datahub_graphql_special_schema: Generic Types +plugin_pimcore_datahub_graphql_special_document: Document +plugin_pimcore_datahub_graphql_special_document_folder: Document Folder +plugin_pimcore_datahub_graphql_special_asset: Asset +plugin_pimcore_datahub_graphql_special_asset_folder: Asset Folder +plugin_pimcore_datahub_graphql_special_object_folder: Object Folder +plugin_pimcore_datahub_graphql_special_asset_listing: Asset Listing +plugin_pimcore_datahub_graphql_special_translation_listing: Translation Listing +plugin_pimcore_datahub_graphql_special_translation: Translation +read: Read +plugin_pimcore_datahub_skip_permission_check: Skip Permission Check +plugin_pimcore_datahub_configpanel_permissions: Permissions +plugin_pimcore_datahub_graphql_permissions_roles: Role Permissions +plugin_pimcore_datahub_graphql_permissions_users: User Permissions +plugin_pimcore_datahub_operator_select_user: Select User +plugin_pimcore_datahub_operator_select_role: Select Role +plugin_pimcore_datahub_configpanel_user: User +plugin_pimcore_datahub_configpanel_role: Role +plugin_pimcore_datahub_disable_introspection: Disable Introspection +plugin_pimcore_datahub_security_introspection_description: 'Please note: When introspection + is disabled, the autocomplete feature will not work.' +plugin_pimcore_datahub_import: Import +plugin_pimcore_datahub_export: Export +... diff --git a/src/Resources/translations/admin.sk.yml b/src/Resources/translations/admin.sk.yml index 24bb548d..3a3e1e3b 100644 --- a/src/Resources/translations/admin.sk.yml +++ b/src/Resources/translations/admin.sk.yml @@ -1,5 +1,5 @@ --- -plugin_pimcore_datahub_toolbar: Datahub +plugin_pimcore_datahub_toolbar: Datahub Config plugin_pimcore_datahub_configpanel_add: Add Configuration plugin_pimcore_datahub_configpanel_enterkey_title: Add a new configuration plugin_pimcore_datahub_configpanel_enterkey_prompt: Unique Identifier diff --git a/src/Resources/translations/admin.sv.yml b/src/Resources/translations/admin.sv.yml index 24bb548d..3a3e1e3b 100644 --- a/src/Resources/translations/admin.sv.yml +++ b/src/Resources/translations/admin.sv.yml @@ -1,5 +1,5 @@ --- -plugin_pimcore_datahub_toolbar: Datahub +plugin_pimcore_datahub_toolbar: Datahub Config plugin_pimcore_datahub_configpanel_add: Add Configuration plugin_pimcore_datahub_configpanel_enterkey_title: Add a new configuration plugin_pimcore_datahub_configpanel_enterkey_prompt: Unique Identifier diff --git a/src/Resources/translations/admin.th.yml b/src/Resources/translations/admin.th.yml index 24bb548d..3a3e1e3b 100644 --- a/src/Resources/translations/admin.th.yml +++ b/src/Resources/translations/admin.th.yml @@ -1,5 +1,5 @@ --- -plugin_pimcore_datahub_toolbar: Datahub +plugin_pimcore_datahub_toolbar: Datahub Config plugin_pimcore_datahub_configpanel_add: Add Configuration plugin_pimcore_datahub_configpanel_enterkey_title: Add a new configuration plugin_pimcore_datahub_configpanel_enterkey_prompt: Unique Identifier diff --git a/src/Resources/translations/admin.zh_Hans.yml b/src/Resources/translations/admin.zh_Hans.yml index 24bb548d..3a3e1e3b 100644 --- a/src/Resources/translations/admin.zh_Hans.yml +++ b/src/Resources/translations/admin.zh_Hans.yml @@ -1,5 +1,5 @@ --- -plugin_pimcore_datahub_toolbar: Datahub +plugin_pimcore_datahub_toolbar: Datahub Config plugin_pimcore_datahub_configpanel_add: Add Configuration plugin_pimcore_datahub_configpanel_enterkey_title: Add a new configuration plugin_pimcore_datahub_configpanel_enterkey_prompt: Unique Identifier