Comments

realityloop created an issue. See original summary.

sahana _n’s picture

Assigned: Unassigned » sahana _n
sahana _n’s picture

Status: Active » Needs review
StatusFileSize
new778 bytes

Please review the patch.

Status: Needs review » Needs work

The last submitted patch, 3: 3122456-3.patch, failed testing. View results

sahana _n’s picture

Status: Needs work » Needs review
ankush_03’s picture

StatusFileSize
new397 bytes

Re-roll patch core version in composer json file is not required.

ankush_03’s picture

Issue tags: +Drupal 9 compatibility
nils.destoop’s picture

StatusFileSize
new1.94 KB

I still had some fatal errors. The getLinkRelationTypes method is renamed too getLinkRelationType and the setting only allows a string instead of an array.

Important, this patch will probably be not compatible with older versions of Drupal 8.

burningdog’s picture

I have an "About Us" content type and an image field. When viewing the "About Us" node in JSON:API, the imageDerivatives property did show (as expected) for the image field, with the expected values (2 image styles, in my case). However, when viewing the related entity, the image field (type file--file) I got the errors which @nils.destoop describes.

Applying his patch to src/Normalizer/LinkCollectionNormalizer.php (on version 4.0.0 of consumer_image_styles) got it working for me on Drupal 9.1.0.

burningdog’s picture

Title: Drupal 9 compatibility » JsonApiResource Link $rel is now a string, not an array; getLinkRelationTypes() is now getLinkRelationType()
Version: 8.x-3.x-dev » 4.x-dev

The specific errors I got were:

TypeError: Argument 3 passed to Drupal\jsonapi\JsonApiResource\Link::__construct() must be of the type string, array given, called in /Users/rs/Sites/back9/back9-drupal/web/modules/contrib/consumer_image_styles/src/Normalizer/LinkCollectionNormalizer.php on line 112 in Drupal\jsonapi\JsonApiResource\Link->__construct() (line 78 of core/modules/jsonapi/src/JsonApiResource/Link.php).

Drupal\jsonapi\JsonApiResource\Link->__construct(Object, Object, Array) (Line: 112)

When that was fixed, then:

Error: Call to undefined method Drupal\jsonapi\JsonApiResource\Link::getLinkRelationTypes() in Drupal\consumer_image_styles\Normalizer\LinkCollectionNormalizer::Drupal\consumer_image_styles\Normalizer\{closure}() (line 173 of modules/contrib/consumer_image_styles/src/Normalizer/LinkCollectionNormalizer.php).

Drupal\consumer_image_styles\Normalizer\LinkCollectionNormalizer::Drupal\consumer_image_styles\Normalizer\{closure}(Array, Object)

When that was fixed, then:

Warning: array_unique() expects parameter 1 to be array, null given in Drupal\consumer_image_styles\Normalizer\LinkCollectionNormalizer::Drupal\consumer_image_styles\Normalizer\{closure}() (line 173 of /Users/rs/Sites/back9/back9-drupal/web/modules/contrib/consumer_image_styles/src/Normalizer/LinkCollectionNormalizer.php).:

These are all fixed by the patch in #8.

mvbaalen’s picture

StatusFileSize
new1.55 KB

Thanks for supplying a patch that fixes this!

The patch supplied in #8 did not apply in 4.0.0 (non dev) version in Drupal 9, because the ^8 || ^9 version requirement is already in there.

Re-rolled the patch for that version.

el1_1el’s picture

Category: Task » Bug report
Priority: Normal » Critical
Status: Needs review » Reviewed & tested by the community

Maybe I'm missing something on priority and status, but after an 8->9 upgrade my site wont build with a fatal error from this issue. Marked as a bug and critical.

#11 fixes the issue. Thanks!

marcvangend’s picture

Assigned: sahana _n » Unassigned

Agree with #12, and thanks for the patches! Let's get this committed.

makkus183’s picture

#11 fixes the issue and saved my deployment! Thx a lot!

nickdjm’s picture

Tested #11 with v4.0.0 and it resolved the issue for me as well.

Thanks for the patch!

pebosi’s picture

Works for me too, please create a new release.

e0ipso’s picture

Status: Reviewed & tested by the community » Fixed

Thanks to all involved with reporting, writing a patch, and testing. This should be fixed and released now.

  • e0ipso committed 5425166 on 4.x authored by mvbaalen
    Issue #3122456 by Sahana _N, ankushgautam76@gmail.com, nils.destoop,...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.