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

Resolved error Too few arguments #13

Merged
merged 1 commit into from
May 28, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/TemplateFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Drupal\Core\Messenger\MessengerInterface;
use Drupal\repec\Series\Base;
use Drupal\repec\Series\BaseInterface;
use Drupal\Core\File\FileSystemInterface;

/**
* TemplateFactory.
Expand Down Expand Up @@ -35,6 +36,13 @@ final class TemplateFactory {
*/
protected $messenger;

/**
* Drupal\Core\File\FileSystemInterface definition.
*
* @var \Drupal\Core\File\FileSystemInterface
*/
protected $fileSystem;

/**
* TemplateFactory constructor.
*
Expand All @@ -45,10 +53,11 @@ final class TemplateFactory {
* @param \Drupal\Core\Messenger\MessengerInterface $messenger
* Messenger.
*/
public function __construct(EntityTypeManagerInterface $entity_type_manager, ConfigFactoryInterface $config_factory, MessengerInterface $messenger) {
public function __construct(EntityTypeManagerInterface $entity_type_manager, ConfigFactoryInterface $config_factory, MessengerInterface $messenger, FileSystemInterface $file_system) {
$this->configFactory = $config_factory;
$this->entityTypeManager = $entity_type_manager;
$this->messenger = $messenger;
$this->fileSystem = $file_system;
}

/**
Expand All @@ -68,7 +77,7 @@ public function create($series_type, ContentEntityInterface $entity) : BaseInter
$repec_settings = $this->configFactory->get('repec.settings');
/** @var array|null $bundle_settings */
$bundle_settings = unserialize($repec_settings->get("repec_bundle.{$entity->getEntityTypeId()}.{$entity->bundle()}"), ['array']);
return new $template_class($repec_settings, $this->entityTypeManager, $this->messenger, $entity, $bundle_settings);
return new $template_class($repec_settings, $this->entityTypeManager, $this->messenger, $entity, $bundle_settings, $this->fileSystem);
}

}