The $file_url_generator argument is missing from the JCarouselFormatter class constructor, which is required for Drupal 10.0.0 or later.
Install & setup the module jCarousel as usual. Create a content page with some images and the carousel block.
In Drupal 10, jCarouselFormatter parent constructor does not match with ImageFormatter because of the missing argument file_url_generator.
Too few arguments to function Drupal\image\Plugin\Field\FieldFormatter\ImageFormatter::__construct(), 9 passed in /var/www/html/docroot/modules/contrib/jcarousel/src/Plugin/Field/FieldFormatter/JCarouselFormatter.php on line 65
In Drupal 9, the ImageFormatter constructor sets its last argument $file_url_generator to NULL by default, but generates a warning that this will be required in Drupal 10.0.0 and later.
public function __construct($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, $label, $view_mode, array $third_party_settings, AccountInterface $current_user, EntityStorageInterface $image_style_storage, FileUrlGeneratorInterface $file_url_generator = NULL) {
parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings, $label, $view_mode, $third_party_settings);
$this->currentUser = $current_user;
$this->imageStyleStorage = $image_style_storage;
if (!$file_url_generator) {
@trigger_error('Calling ImageFormatter::__construct() without the $file_url_generator argument is deprecated in drupal:9.3.0 and the $file_url_generator argument will be required in drupal:10.0.0. See https://www.drupal.org/node/2940031', E_USER_DEPRECATED);
$file_url_generator = \Drupal::service('file_url_generator');
}
$this->fileUrlGenerator = $file_url_generator;
}
Add the last argument $file_url_generator and inject the corresponding service in the jCarouselFormatter class constructor.
Needs review
6.0
Code