Replace deprecated '#item_attributes' with '#attributes' in image_formatter and responsive_image_formatter render arrays
$element = [
'#theme' => 'image_formatter',
'#item' => $item,
- '#item_attributes' => ['class' => ['my-image']],
+ '#attributes' => ['class' => ['my-image']],
];
Configure your rector.php:
<?php
use DrupalRector\Drupal11\Rector\Deprecation\ReplaceItemAttributesWithAttributesRector;
use DrupalRector\Rector\ValueObject\DrupalIntroducedVersionConfiguration;
use Rector\Config\RectorConfig;
return RectorConfig::configure()
->withConfiguredRule(ReplaceItemAttributesWithAttributesRector::class, [
new DrupalIntroducedVersionConfiguration('11.4.0'),
]);