Skip to content

Commit

Permalink
TypedConfigManager new parameter addition to config forms
Browse files Browse the repository at this point in the history
  • Loading branch information
kedarkhaire committed Feb 20, 2025
1 parent 0047deb commit fddc405
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
11 changes: 8 additions & 3 deletions src/Form/PrepaidBalanceConfigForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

use Drupal\Core\Cache\Cache;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Config\TypedConfigManagerInterface;
use Drupal\Core\Datetime\DateFormatterInterface;
use Drupal\Core\Form\ConfigFormBase;
use Drupal\Core\Form\FormStateInterface;
Expand All @@ -45,9 +46,12 @@ class PrepaidBalanceConfigForm extends ConfigFormBase {

/**
* {@inheritdoc}
*
* @param \Drupal\Core\Config\TypedConfigManagerInterface $typed_config_manager
* The typed config manager.
*/
public function __construct(ConfigFactoryInterface $config_factory, DateFormatterInterface $date_formatter) {
parent::__construct($config_factory);
public function __construct(ConfigFactoryInterface $config_factory, DateFormatterInterface $date_formatter, TypedConfigManagerInterface $typed_config_manager) {
parent::__construct($config_factory, $typed_config_manager);

$this->dateFormatter = $date_formatter;
}
Expand All @@ -58,7 +62,8 @@ public function __construct(ConfigFactoryInterface $config_factory, DateFormatte
public static function create(ContainerInterface $container) {
return new static(
$container->get('config.factory'),
$container->get('date.formatter')
$container->get('date.formatter'),
$container->get('config.typed')
);
}

Expand Down
10 changes: 7 additions & 3 deletions src/Form/RatePlanConfigForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
namespace Drupal\apigee_m10n\Form;

use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Config\TypedConfigManagerInterface;
use Drupal\Core\Entity\EntityDisplayRepositoryInterface;
use Drupal\Core\Form\ConfigFormBase;
use Drupal\Core\Form\FormStateInterface;
Expand Down Expand Up @@ -48,9 +49,11 @@ class RatePlanConfigForm extends ConfigFormBase {
* The factory for configuration objects.
* @param \Drupal\Core\Entity\EntityDisplayRepositoryInterface $entity_display_repository
* The entity display repository.
* @param \Drupal\Core\Config\TypedConfigManagerInterface $typed_config_manager
* The typed config manager.
*/
public function __construct(ConfigFactoryInterface $config_factory, EntityDisplayRepositoryInterface $entity_display_repository) {
parent::__construct($config_factory);
public function __construct(ConfigFactoryInterface $config_factory, EntityDisplayRepositoryInterface $entity_display_repository, TypedConfigManagerInterface $typed_config_manager) {
parent::__construct($config_factory, $typed_config_manager);
$this->entity_display_repository = $entity_display_repository;
}

Expand All @@ -60,7 +63,8 @@ public function __construct(ConfigFactoryInterface $config_factory, EntityDispla
public static function create(ContainerInterface $container) {
return new static(
$container->get('config.factory'),
$container->get('entity_display.repository')
$container->get('entity_display.repository'),
$container->get('config.typed')
);
}

Expand Down

0 comments on commit fddc405

Please sign in to comment.