Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HPC-9391: Fix service argument to prevent fatal errors #929

Merged
merged 1 commit into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ services:
arguments: ['@entity_type.manager', '@plugin.manager.endpoint_query_manager', '@smugmug_api.image', '@file_system']
hero_image_widget_crop.manager:
class: Drupal\ghi_hero_image\HeroImageWidgetCropManager
arguments: ['@entity_type.manager', '@config.factory', '@hero_image.manager', '@file.mime_type.guesser', '?@ghi_image.crop_manager']
arguments: ['@entity_type.manager', '@config.factory', '@hero_image.manager', '@file.mime_type.guesser', '@?ghi_image.crop_manager']
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@

namespace Drupal\ghi_hero_image;

use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\DependencyInjection\DependencySerializationTrait;
use Drupal\Core\Entity\ContentEntityFormInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\crop\Entity\CropType;
use Drupal\file\Entity\File;
use Drupal\file\Plugin\Field\FieldType\FileFieldItemList;
use Drupal\ghi_hero_image\Plugin\Field\FieldType\HeroImageItem;
use Drupal\ghi_image\CropManager;
use Drupal\image_widget_crop\ImageWidgetCropInterface;
use Drupal\image_widget_crop\ImageWidgetCropManager;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Mime\MimeTypeGuesserInterface;

/**
* HeroImageWidgetCropManager class.
Expand All @@ -25,7 +27,7 @@
*
* @see \Drupal\ghi_image\CropManager
*/
class HeroImageWidgetCropManager extends ImageWidgetCropManager implements ImageWidgetCropInterface, ContainerInjectionInterface {
class HeroImageWidgetCropManager extends ImageWidgetCropManager implements ImageWidgetCropInterface {

use DependencySerializationTrait;

Expand Down Expand Up @@ -61,17 +63,13 @@ class HeroImageWidgetCropManager extends ImageWidgetCropManager implements Image
protected $cropManager;

/**
* {@inheritdoc}
* Public constructor.
*/
public static function create(ContainerInterface $container) {
$instance = new static(
$container->get('entity_type.manager'),
$container->get('config.factory')
);
$instance->heroImageManager = $container->get('hero_image.manager');
$instance->mimeTypeGuesser = $container->get('file.mime_type.guesser');
$instance->cropManager = $container->get('ghi_image.crop_manager');
return $instance;
public function __construct(EntityTypeManagerInterface $entity_type_manager, ConfigFactoryInterface $config_factory, HeroImageManager $hero_image_manager, MimeTypeGuesserInterface $mime_type_guesser, CropManager $crop_manager) {
parent::__construct($entity_type_manager, $config_factory);
$this->heroImageManager = $hero_image_manager;
$this->mimeTypeGuesser = $mime_type_guesser;
$this->cropManager = $crop_manager;
}

/**
Expand Down
Loading