Problem/Motivation

After installing the module and navigating to /admin/config/people/pcp, the site throws a fatal error instead of displaying the configuration form:

ArgumentCountError: Too few arguments to function Drupal\Core\Form\ConfigFormBase::__construct(), 1 passed in /var/www/html/xxxxxxx/web/modules/contrib/pcp/src/Form/PCPForm.php on line 33 and exactly 2 expected in Drupal\Core\Form\ConfigFormBase->__construct() (line 45 of /var/www/html/xxxxxxx/web/core/lib/Drupal/Core/Form/ConfigFormBase.php).

Steps to reproduce

  1. Install the pcp module on a Drupal 11.4.
  2. Navigate to /admin/config/people/pcp.
  3. Observe the fatal error above instead of the settings form.

Proposed resolution

In PCPForm.php:

1. Add the import:
use Drupal\Core\Config\TypedConfigManagerInterface;

2. Update the constructor to accept and forward the typed config manager:

public function __construct(
  ConfigFactoryInterface $config_factory,
  TypedConfigManagerInterface $typed_config_manager
) {
  parent::__construct($config_factory, $typed_config_manager);
}

3. Update create() to inject the new service:

public static function create(ContainerInterface $container) {
  return new static(
    $container->get('config.factory'),
    $container->get('config.typed')
  );
}

Issue fork pcp-3608602

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

dkmishra created an issue. See original summary.

garvitasakhrani made their first commit to this issue’s fork.

garvitasakhrani’s picture

Status: Active » Needs review

Updated PCPForm to inject the typed config manager required by Drupal 11, resolving the ConfigFormBase::__construct() ArgumentCountError.
Please review. Thanks!