From fd504079809859f68fd6527f0a7448f326794fc4 Mon Sep 17 00:00:00 2001 From: bach Date: Mon, 11 Mar 2024 14:34:59 +0100 Subject: [PATCH] fixed graphql image alt and title --- src/composer.json | 10 +- src/composer.lock | 178 +++++++++--------- .../graphql/ouatt_extension.base.graphqls | 12 +- .../SchemaExtension/OuattSchemaExtension.php | 121 +++++++++--- 4 files changed, 200 insertions(+), 121 deletions(-) diff --git a/src/composer.json b/src/composer.json index f84827f..f5f9d2b 100644 --- a/src/composer.json +++ b/src/composer.json @@ -143,15 +143,17 @@ "drupal/paragraphs": { "Skip saving empty paragraphs for certain types https://www.drupal.org/project/paragraphs/issues/2877695" : "https://www.drupal.org/files/issues/2022-11-10/skip_saving_empty_paragraphs-2877695-43.patch" }, - "drupal/graphql": { - "invalid translation language https://github.com/drupal-graphql/graphql/pull/1176": "./patches/graphql-fix-invalid-translation-language-dev.patch" - }, "drupal/email_registration": { "Allow authentication via mail and password over RPC https://www.drupal.org/project/email_registration/issues/2856542": "https://www.drupal.org/files/issues/2021-06-11/2856542-13.patch" }, "drupal/group": { "Empty page when trying to create group node https://www.drupal.org/project/group/issues/2842630": "https://www.drupal.org/files/issues/2022-09-02/group-2842630-40-v3.patch" } - } + }, + "oldpatches": { + "drupal/graphql": { + "invalid translation language https://github.com/drupal-graphql/graphql/pull/1176": "./patches/graphql-fix-invalid-translation-language-dev.patch" + } + } } } diff --git a/src/composer.lock b/src/composer.lock index 8314360..a28d1d7 100644 --- a/src/composer.lock +++ b/src/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "b22ced6a38f98c413636049595ba7ec0", + "content-hash": "fedcb6b2688c7a76ce3b486283f839fc", "packages": [ { "name": "alchemy/zippy", @@ -1664,25 +1664,29 @@ }, { "name": "doctrine/deprecations", - "version": "v1.0.0", + "version": "1.1.3", "source": { "type": "git", "url": "https://github.com/doctrine/deprecations.git", - "reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de" + "reference": "dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/deprecations/zipball/0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de", - "reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de", + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab", + "reference": "dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab", "shasum": "" }, "require": { - "php": "^7.1|^8.0" + "php": "^7.1 || ^8.0" }, "require-dev": { "doctrine/coding-standard": "^9", - "phpunit/phpunit": "^7.5|^8.5|^9.5", - "psr/log": "^1|^2|^3" + "phpstan/phpstan": "1.4.10 || 1.10.15", + "phpstan/phpstan-phpunit": "^1.0", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "psalm/plugin-phpunit": "0.18.4", + "psr/log": "^1 || ^2 || ^3", + "vimeo/psalm": "4.30.0 || 5.12.0" }, "suggest": { "psr/log": "Allows logging deprecations via PSR-3 logger implementation" @@ -1701,9 +1705,9 @@ "homepage": "https://www.doctrine-project.org/", "support": { "issues": "https://github.com/doctrine/deprecations/issues", - "source": "https://github.com/doctrine/deprecations/tree/v1.0.0" + "source": "https://github.com/doctrine/deprecations/tree/1.1.3" }, - "time": "2022-05-02T15:47:09+00:00" + "time": "2024-01-30T19:34:25+00:00" }, { "name": "doctrine/event-manager", @@ -2073,20 +2077,20 @@ }, { "name": "doctrine/reflection", - "version": "1.2.3", + "version": "1.2.4", "source": { "type": "git", "url": "https://github.com/doctrine/reflection.git", - "reference": "1034e5e71f89978b80f9c1570e7226f6c3b9b6fb" + "reference": "6bcea3e81ab8b3d0abe5fde5300bbc8a968960c7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/reflection/zipball/1034e5e71f89978b80f9c1570e7226f6c3b9b6fb", - "reference": "1034e5e71f89978b80f9c1570e7226f6c3b9b6fb", + "url": "https://api.github.com/repos/doctrine/reflection/zipball/6bcea3e81ab8b3d0abe5fde5300bbc8a968960c7", + "reference": "6bcea3e81ab8b3d0abe5fde5300bbc8a968960c7", "shasum": "" }, "require": { - "doctrine/annotations": "^1.0", + "doctrine/annotations": "^1.0 || ^2.0", "ext-tokenizer": "*", "php": "^7.1 || ^8.0" }, @@ -2144,10 +2148,10 @@ ], "support": { "issues": "https://github.com/doctrine/reflection/issues", - "source": "https://github.com/doctrine/reflection/tree/1.2.3" + "source": "https://github.com/doctrine/reflection/tree/1.2.4" }, "abandoned": "roave/better-reflection", - "time": "2022-05-31T18:46:25+00:00" + "time": "2023-07-27T18:11:59+00:00" }, { "name": "drupal/address", @@ -6164,7 +6168,7 @@ "source": { "type": "git", "url": "https://git.drupalcode.org/project/graphql.git", - "reference": "dedd45ccdea0430b7820acbad4557dc443eff196" + "reference": "f4a80c579375b591974e4eb26107592669a19904" }, "require": { "drupal/core": "^9.3 || ^10", @@ -6181,8 +6185,8 @@ "dev-4.x": "4.x-dev" }, "drupal": { - "version": "8.x-4.3+11-dev", - "datestamp": "1662992472", + "version": "8.x-4.6+16-dev", + "datestamp": "1708799575", "security-coverage": { "status": "not-covered", "message": "Dev releases are not covered by Drupal security advisories." @@ -6206,10 +6210,18 @@ "name": "joaogarin", "homepage": "https://www.drupal.org/user/612814" }, + { + "name": "Kingdutch", + "homepage": "https://www.drupal.org/user/1868952" + }, { "name": "klausi", "homepage": "https://www.drupal.org/user/262198" }, + { + "name": "luigisa", + "homepage": "https://www.drupal.org/user/1022312" + }, { "name": "pmelab", "homepage": "https://www.drupal.org/user/555322" @@ -9119,7 +9131,7 @@ "source": { "type": "git", "url": "https://git.drupalcode.org/project/typed_data.git", - "reference": "94141cf338e5a3a3ec8bdea276bce6a0a84c4bfa" + "reference": "fefd97f6f0a4da282f6bc66695d78010c96434e6" }, "require": { "drupal/core": "^9.1 || ^10" @@ -9130,8 +9142,8 @@ "dev-1.x": "1.x-dev" }, "drupal": { - "version": "8.x-1.0-beta1+12-dev", - "datestamp": "1650833384", + "version": "8.x-1.0-beta1+20-dev", + "datestamp": "1678944501", "security-coverage": { "status": "not-covered", "message": "Dev releases are not covered by Drupal security advisories." @@ -9139,7 +9151,7 @@ }, "drush": { "services": { - "drush.services.yml": "^9 || ^10" + "drush.services.yml": ">=9" } } }, @@ -9148,13 +9160,13 @@ "GPL-2.0-or-later" ], "authors": [ - { - "name": "TR", - "homepage": "https://www.drupal.org/user/202830" - }, { "name": "fago", "homepage": "https://www.drupal.org/user/16747" + }, + { + "name": "TR", + "homepage": "https://www.drupal.org/user/202830" } ], "description": "Extends the core Typed Data API with new APIs and features.", @@ -9800,16 +9812,16 @@ }, { "name": "egulias/email-validator", - "version": "3.2.5", + "version": "3.2.6", "source": { "type": "git", "url": "https://github.com/egulias/EmailValidator.git", - "reference": "b531a2311709443320c786feb4519cfaf94af796" + "reference": "e5997fa97e8790cdae03a9cbd5e78e45e3c7bda7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/b531a2311709443320c786feb4519cfaf94af796", - "reference": "b531a2311709443320c786feb4519cfaf94af796", + "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/e5997fa97e8790cdae03a9cbd5e78e45e3c7bda7", + "reference": "e5997fa97e8790cdae03a9cbd5e78e45e3c7bda7", "shasum": "" }, "require": { @@ -9855,7 +9867,7 @@ ], "support": { "issues": "https://github.com/egulias/EmailValidator/issues", - "source": "https://github.com/egulias/EmailValidator/tree/3.2.5" + "source": "https://github.com/egulias/EmailValidator/tree/3.2.6" }, "funding": [ { @@ -9863,7 +9875,7 @@ "type": "github" } ], - "time": "2023-01-02T17:26:14+00:00" + "time": "2023-06-01T07:04:22+00:00" }, { "name": "enlightn/security-checker", @@ -11161,21 +11173,22 @@ }, { "name": "pear/pear-core-minimal", - "version": "v1.10.13", + "version": "v1.10.15", "source": { "type": "git", "url": "https://github.com/pear/pear-core-minimal.git", - "reference": "aed862e95fd286c53cc546734868dc38ff4b5b1d" + "reference": "d457b5c93e5001fbf4b5726d21038266e029e3be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pear/pear-core-minimal/zipball/aed862e95fd286c53cc546734868dc38ff4b5b1d", - "reference": "aed862e95fd286c53cc546734868dc38ff4b5b1d", + "url": "https://api.github.com/repos/pear/pear-core-minimal/zipball/d457b5c93e5001fbf4b5726d21038266e029e3be", + "reference": "d457b5c93e5001fbf4b5726d21038266e029e3be", "shasum": "" }, "require": { "pear/console_getopt": "~1.4", - "pear/pear_exception": "~1.0" + "pear/pear_exception": "~1.0", + "php": ">=5.4" }, "replace": { "rsky/pear-core-min": "self.version" @@ -11205,7 +11218,7 @@ "issues": "http://pear.php.net/bugs/search.php?cmd=display&package_name[]=PEAR", "source": "https://github.com/pear/pear-core-minimal" }, - "time": "2023-04-19T19:15:47+00:00" + "time": "2024-03-09T19:38:40+00:00" }, { "name": "pear/pear_exception", @@ -13002,16 +13015,16 @@ }, { "name": "symfony/http-kernel", - "version": "v4.4.50", + "version": "v4.4.51", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "aa6df6c045f034aa13ac752fc234bb300b9488ef" + "reference": "ad8ab192cb619ff7285c95d28c69b36d718416c7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/aa6df6c045f034aa13ac752fc234bb300b9488ef", - "reference": "aa6df6c045f034aa13ac752fc234bb300b9488ef", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/ad8ab192cb619ff7285c95d28c69b36d718416c7", + "reference": "ad8ab192cb619ff7285c95d28c69b36d718416c7", "shasum": "" }, "require": { @@ -13086,7 +13099,7 @@ "description": "Provides a structured process for converting a Request into a Response", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-kernel/tree/v4.4.50" + "source": "https://github.com/symfony/http-kernel/tree/v4.4.51" }, "funding": [ { @@ -13102,7 +13115,7 @@ "type": "tidelift" } ], - "time": "2023-02-01T08:01:31+00:00" + "time": "2023-11-10T13:31:29+00:00" }, { "name": "symfony/mime", @@ -13608,16 +13621,16 @@ }, { "name": "symfony/polyfill-php72", - "version": "v1.27.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "869329b1e9894268a8a61dabb69153029b7a8c97" + "reference": "861391a8da9a04cbad2d232ddd9e4893220d6e25" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/869329b1e9894268a8a61dabb69153029b7a8c97", - "reference": "869329b1e9894268a8a61dabb69153029b7a8c97", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/861391a8da9a04cbad2d232ddd9e4893220d6e25", + "reference": "861391a8da9a04cbad2d232ddd9e4893220d6e25", "shasum": "" }, "require": { @@ -13625,9 +13638,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.27-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -13664,7 +13674,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php72/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-php72/tree/v1.29.0" }, "funding": [ { @@ -13680,20 +13690,20 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "symfony/polyfill-php73", - "version": "v1.27.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "9e8ecb5f92152187c4799efd3c96b78ccab18ff9" + "reference": "21bd091060673a1177ae842c0ef8fe30893114d2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/9e8ecb5f92152187c4799efd3c96b78ccab18ff9", - "reference": "9e8ecb5f92152187c4799efd3c96b78ccab18ff9", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/21bd091060673a1177ae842c0ef8fe30893114d2", + "reference": "21bd091060673a1177ae842c0ef8fe30893114d2", "shasum": "" }, "require": { @@ -13701,9 +13711,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.27-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -13743,7 +13750,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.29.0" }, "funding": [ { @@ -13759,7 +13766,7 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "symfony/polyfill-php80", @@ -14614,16 +14621,16 @@ }, { "name": "symfony/var-dumper", - "version": "v5.4.23", + "version": "v5.4.36", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "9a8a5b6d6508928174ded2109e29328a55342a42" + "reference": "2e9c2b11267119d9c90d6b3fdce5e4e9f15e2e90" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/9a8a5b6d6508928174ded2109e29328a55342a42", - "reference": "9a8a5b6d6508928174ded2109e29328a55342a42", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/2e9c2b11267119d9c90d6b3fdce5e4e9f15e2e90", + "reference": "2e9c2b11267119d9c90d6b3fdce5e4e9f15e2e90", "shasum": "" }, "require": { @@ -14632,12 +14639,12 @@ "symfony/polyfill-php80": "^1.16" }, "conflict": { - "phpunit/phpunit": "<5.4.3", "symfony/console": "<4.4" }, "require-dev": { "ext-iconv": "*", "symfony/console": "^4.4|^5.0|^6.0", + "symfony/http-kernel": "^4.4|^5.0|^6.0", "symfony/process": "^4.4|^5.0|^6.0", "symfony/uid": "^5.1|^6.0", "twig/twig": "^2.13|^3.0.4" @@ -14683,7 +14690,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v5.4.23" + "source": "https://github.com/symfony/var-dumper/tree/v5.4.36" }, "funding": [ { @@ -14699,7 +14706,7 @@ "type": "tidelift" } ], - "time": "2023-04-18T09:26:27+00:00" + "time": "2024-02-15T11:19:14+00:00" }, { "name": "symfony/yaml", @@ -14774,16 +14781,16 @@ }, { "name": "twig/twig", - "version": "v2.15.5", + "version": "v2.15.6", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "fc02a6af3eeb97c4bf5650debc76c2eda85ac22e" + "reference": "ad637405a828601a56f32ccab9a85541c4b66c9d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/fc02a6af3eeb97c4bf5650debc76c2eda85ac22e", - "reference": "fc02a6af3eeb97c4bf5650debc76c2eda85ac22e", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/ad637405a828601a56f32ccab9a85541c4b66c9d", + "reference": "ad637405a828601a56f32ccab9a85541c4b66c9d", "shasum": "" }, "require": { @@ -14794,7 +14801,7 @@ }, "require-dev": { "psr/container": "^1.0", - "symfony/phpunit-bridge": "^4.4.9|^5.0.9|^6.0" + "symfony/phpunit-bridge": "^5.4.9|^6.3" }, "type": "library", "extra": { @@ -14838,7 +14845,7 @@ ], "support": { "issues": "https://github.com/twigphp/Twig/issues", - "source": "https://github.com/twigphp/Twig/tree/v2.15.5" + "source": "https://github.com/twigphp/Twig/tree/v2.15.6" }, "funding": [ { @@ -14850,7 +14857,7 @@ "type": "tidelift" } ], - "time": "2023-05-03T17:49:41+00:00" + "time": "2023-11-21T17:34:48+00:00" }, { "name": "typo3/phar-stream-wrapper", @@ -15062,16 +15069,16 @@ }, { "name": "webonyx/graphql-php", - "version": "v14.11.6", + "version": "v14.11.10", "source": { "type": "git", "url": "https://github.com/webonyx/graphql-php.git", - "reference": "6070542725b61fc7d0654a8a9855303e5e157434" + "reference": "d9c2fdebc6aa01d831bc2969da00e8588cffef19" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webonyx/graphql-php/zipball/6070542725b61fc7d0654a8a9855303e5e157434", - "reference": "6070542725b61fc7d0654a8a9855303e5e157434", + "url": "https://api.github.com/repos/webonyx/graphql-php/zipball/d9c2fdebc6aa01d831bc2969da00e8588cffef19", + "reference": "d9c2fdebc6aa01d831bc2969da00e8588cffef19", "shasum": "" }, "require": { @@ -15091,8 +15098,7 @@ "phpunit/phpunit": "^7.2 || ^8.5", "psr/http-message": "^1.0", "react/promise": "2.*", - "simpod/php-coveralls-mirror": "^3.0", - "squizlabs/php_codesniffer": "3.5.4" + "simpod/php-coveralls-mirror": "^3.0" }, "suggest": { "psr/http-message": "To use standard GraphQL server", @@ -15116,7 +15122,7 @@ ], "support": { "issues": "https://github.com/webonyx/graphql-php/issues", - "source": "https://github.com/webonyx/graphql-php/tree/v14.11.6" + "source": "https://github.com/webonyx/graphql-php/tree/v14.11.10" }, "funding": [ { @@ -15124,7 +15130,7 @@ "type": "open_collective" } ], - "time": "2022-04-13T16:25:32+00:00" + "time": "2023-07-05T14:23:37+00:00" }, { "name": "wikimedia/composer-merge-plugin", diff --git a/src/web/modules/custom/ouatt_graphql/graphql/ouatt_extension.base.graphqls b/src/web/modules/custom/ouatt_graphql/graphql/ouatt_extension.base.graphqls index 2768267..f94a6bb 100644 --- a/src/web/modules/custom/ouatt_graphql/graphql/ouatt_extension.base.graphqls +++ b/src/web/modules/custom/ouatt_graphql/graphql/ouatt_extension.base.graphqls @@ -52,6 +52,7 @@ type Entite implements NodeInterface { sources: [Source] concernement: Concernement image: [Image] + } type Source { @@ -222,10 +223,17 @@ type VideoLink { url: String } +# type Imagefield { +# image: Image! +# title: String +# alt: String +# } + type Image { - id: Int! - url: String! + id: Int + url: String alt: String + title: String # style_minicard: ImageStyle # style_minicard_url: String # style_linkedmaterialcard: ImageStyle diff --git a/src/web/modules/custom/ouatt_graphql/src/Plugin/GraphQL/SchemaExtension/OuattSchemaExtension.php b/src/web/modules/custom/ouatt_graphql/src/Plugin/GraphQL/SchemaExtension/OuattSchemaExtension.php index d8b5157..f2492a4 100644 --- a/src/web/modules/custom/ouatt_graphql/src/Plugin/GraphQL/SchemaExtension/OuattSchemaExtension.php +++ b/src/web/modules/custom/ouatt_graphql/src/Plugin/GraphQL/SchemaExtension/OuattSchemaExtension.php @@ -66,6 +66,8 @@ class OuattSchemaExtension extends SdlSchemaExtensionPluginBase { // $this->addVideolink($registry, $builder); // + // $this->addImagefield($registry, $builder); + // $this->addImage($registry, $builder); // $this->addTaxoterm($registry, $builder); @@ -430,10 +432,28 @@ class OuattSchemaExtension extends SdlSchemaExtensionPluginBase { // image: [Image] $registry->addFieldResolver('Entite', 'image', - $builder->produce('entity_reference') - ->map('entity', $builder->fromParent()) - ->map('field', $builder->fromValue('field_image')) - ); + // $builder->produce('entity_reference') + // ->map('entity', $builder->fromParent()) + // ->map('field', $builder->fromValue('field_image')) + $builder->produce('property_path') + ->map('type', $builder->fromValue('entity:node')) + ->map('value', $builder->fromParent()) + ->map('path', $builder->fromValue('field_image')) + ); + + + // $registry->addFieldResolver('Entite', 'image', + // $builder->compose( + // $builder->produce('entity_reference') + // ->map('entity', $builder->fromParent()) + // ->map('field', $builder->fromValue('field_image')), + // $builder->map( + // $builder->produce('image_derivative') + // ->map('entity', $builder->fromParent()) + // ->map('style', $builder->fromValue('my_image_style')) + // ) + // ) + // ); // superposition: [Entite] $registry->addFieldResolver('Entite', 'superposition', @@ -1600,44 +1620,87 @@ class OuattSchemaExtension extends SdlSchemaExtensionPluginBase { ); } + + // protected function addImageField(ResolverRegistryInterface $registry, ResolverBuilder $builder) { + // $registry->addFieldResolver('Imagefield', 'image', + // $builder->callback(function ($parent, $args) { + // if (is_array($parent) && isset($parent['target_id'])) { + // return \Drupal\file\Entity\File::load($parent['target_id']); + // } else if (is_array($parent) && isset($parent[0]['target_id'])) { + // return \Drupal\file\Entity\File::load($parent[0]['target_id']); + // } else{ + // return $parent; + // } + // }) + + // ); + + + // // $registry->addFieldResolver('Imagefield', 'alt', + // // $builder->callback(function ($parent, $args) { + // // $t="t"; + // // // return isset($parent[0]) ? $parent[0]['alt'] : null; + // // return "Alt"; + // // }) + // // ); + + // } + // ___ // |_ _|_ __ __ _ __ _ ___ // | || ' \/ _` / _` / -_) // |___|_|_|_\__,_\__, \___| // |___/ protected function addImage(ResolverRegistryInterface $registry, ResolverBuilder $builder) { - $registry->addFieldResolver('Image', 'id', - $builder->produce('entity_id') - ->map('entity', $builder->fromParent()) - ); + // $registry->addFieldResolver('Image', 'id', + // $builder->produce('entity_id') + // ->map('entity', $builder->fromParent()) + // ); + + $registry->addFieldResolver('Image', 'id', + $builder->callback(function($parent, $args){ + return $parent['target_id']; + }) + ); $registry->addFieldResolver('Image', 'url', - $builder->produce('image_url') - ->map('entity', $builder->fromParent()) + $builder->compose( + $builder->callback(function($parent, $args){ + return \Drupal\file\Entity\File::load($parent['target_id']); + }), + $builder->produce('image_url') + ->map('entity', $builder->fromParent()), + ) ); + $registry->addFieldResolver('Image', 'alt', - $builder->produce('property_path') - ->map('type', $builder->fromValue('entity:node')) - ->map('value', $builder->fromParent()) - ->map('path', $builder->fromValue('field_image.alt')) - ); + $builder->callback(function($parent, $args){ + return $parent['alt']; + }) + ); - $registry->addFieldResolver('Image', 'style_minicard', - $builder->produce('image_derivative') - ->map('entity', $builder->fromParent()) - ->map('style', $builder->fromValue('card_medium_half')) - ); + $registry->addFieldResolver('Image', 'tilte', + $builder->callback(function($parent, $args){ + return $parent['tilte']; + }) + ); - $registry->addFieldResolver('Image', 'style_minicard_url', - $builder->compose( - $builder->produce('image_derivative') - ->map('entity', $builder->fromParent()) - ->map('style', $builder->fromValue('card_medium_half')), - $builder->callback(function($parent, $args){ - return $parent['url']; - }) - )); + // $registry->addFieldResolver('Image', 'style_minicard', + // $builder->produce('image_derivative') + // ->map('entity', $builder->fromParent()) + // ->map('style', $builder->fromValue('card_medium_half')) + // ); + + // $registry->addFieldResolver('Image', 'style_minicard_url', + // $builder->compose( + // $builder->produce('image_derivative') + // ->map('entity', $builder->fromParent()) + // ->map('style', $builder->fromValue('card_medium_half')), + // $builder->callback(function($parent, $args){ + // return $parent['url']; + // }) + // )); }