Problem/Motivation
On install using the latest 10.x branch, im seeing errors
ArgumentCountError: Too few arguments to function Drupal\front_page\EventSubscriber\FrontPageSubscriber::__construct(), 3 passed in /var/www/html/web/core/lib/Drupal/Component/DependencyInjection/Container.php on line 259 and exactly 4 expected in Drupal\front_page\EventSubscriber\FrontPageSubscriber->__construct() (line 65 of /var/www/html/web/modules/contrib/front/src/EventSubscriber/FrontPageSubscriber.php).
Steps to reproduce
1. Fresh install of D10.2.4
2. Clone the front_page repo
3. Checkout 10.x
4. Enable front_page
Proposed resolution
Add the kill switch service to the service definition
Current service
services:
front_page.event_subscriber:
class: Drupal\front_page\EventSubscriber\FrontPageSubscriber
arguments: ['@state', '@config.factory', '@current_user']
tags:
- {name: event_subscriber}
Current event subscriber construct
/**
* Constructs the Event Subscriber object.
*
* @param \Drupal\Core\State\StateInterface $state
* The state key value store.
* @param \Drupal\Core\Config\ConfigFactoryInterface $config
* The config factory service.
* @param \Drupal\Core\Session\AccountInterface $current_user
* The current user.
* @param \Drupal\Core\PageCache\ResponsePolicy\KillSwitch $pageCacheKillSwitch
* The page cache kill switch.
*/
public function __construct(StateInterface $state, ConfigFactoryInterface $config, AccountInterface $current_user, KillSwitch $pageCacheKillSwitch) {
$this->state = $state;
$this->config = $config->get('front_page.settings');
$this->currentUser = $current_user;
$this->pageCacheKillSwitch = $pageCacheKillSwitch;
}