Skip to content

Commit

Permalink
TypedConfigManager new parameter addition to config forms (#1109)
Browse files Browse the repository at this point in the history
  • Loading branch information
kedarkhaire authored Jan 20, 2025
1 parent 424d17e commit 9f0de7a
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 18 deletions.
13 changes: 10 additions & 3 deletions modules/apigee_edge_debug/src/Form/ConfigForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
namespace Drupal\apigee_edge_debug\Form;

use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Config\TypedConfigManagerInterface;
use Drupal\Core\Form\ConfigFormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\apigee_edge_debug\DebugMessageFormatterPluginManager;
Expand All @@ -45,17 +46,23 @@ class ConfigForm extends ConfigFormBase {
* The config factory.
* @param \Drupal\apigee_edge_debug\DebugMessageFormatterPluginManager $plugin_manager
* The debug message formatter plugin manager.
* @param \Drupal\Core\Config\TypedConfigManagerInterface $typed_config_manager
* The typed config manager.
*/
public function __construct(ConfigFactoryInterface $config_factory, DebugMessageFormatterPluginManager $plugin_manager) {
parent::__construct($config_factory);
public function __construct(ConfigFactoryInterface $config_factory, DebugMessageFormatterPluginManager $plugin_manager, TypedConfigManagerInterface $typed_config_manager) {
parent::__construct($config_factory, $typed_config_manager);
$this->pluginManager = $plugin_manager;
}

/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static($container->get('config.factory'), $container->get('plugin.manager.apigee_edge_debug.debug_message_formatter'));
return new static(
$container->get('config.factory'),
$container->get('plugin.manager.apigee_edge_debug.debug_message_formatter'),
$container->get('config.typed')
);
}

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

use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Config\TypedConfigManagerInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Form\ConfigFormBase;
use Drupal\Core\Form\FormStateInterface;
Expand All @@ -45,9 +46,11 @@ class ApiProductAccessControlForm extends ConfigFormBase {
* The config factory service.
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager service.
* @param \Drupal\Core\Config\TypedConfigManagerInterface $typed_config_manager
* The typed config manager.
*/
public function __construct(ConfigFactoryInterface $config_factory, EntityTypeManagerInterface $entity_type_manager) {
parent::__construct($config_factory);
public function __construct(ConfigFactoryInterface $config_factory, EntityTypeManagerInterface $entity_type_manager, TypedConfigManagerInterface $typed_config_manager) {
parent::__construct($config_factory, $typed_config_manager);
$this->entityTypeManager = $entity_type_manager;
}

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

Expand Down
10 changes: 7 additions & 3 deletions src/Form/AppAnalyticsSettingsForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

use Apigee\Edge\Api\Management\Controller\EnvironmentController;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Config\TypedConfigManagerInterface;
use Drupal\Core\Form\ConfigFormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\apigee_edge\SDKConnectorInterface;
Expand All @@ -45,9 +46,11 @@ class AppAnalyticsSettingsForm extends ConfigFormBase {
* The factory for configuration objects.
* @param \Drupal\apigee_edge\SDKConnectorInterface $sdk_connector
* The SDK connector service.
* @param \Drupal\Core\Config\TypedConfigManagerInterface $typed_config_manager
* The typed config manager.
*/
public function __construct(ConfigFactoryInterface $config_factory, SDKConnectorInterface $sdk_connector) {
parent::__construct($config_factory);
public function __construct(ConfigFactoryInterface $config_factory, SDKConnectorInterface $sdk_connector, TypedConfigManagerInterface $typed_config_manager) {
parent::__construct($config_factory, $typed_config_manager);
$this->environmentController = new EnvironmentController($sdk_connector->getOrganization(), $sdk_connector->getClient());
}

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

Expand Down
10 changes: 7 additions & 3 deletions src/Form/AppSettingsForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use Drupal\Core\Ajax\AjaxResponse;
use Drupal\Core\Ajax\ReplaceCommand;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Config\TypedConfigManagerInterface;
use Drupal\Core\Entity\EntityStorageException;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Form\ConfigFormBase;
Expand Down Expand Up @@ -58,9 +59,11 @@ class AppSettingsForm extends ConfigFormBase {
* The entity type manager service.
* @param \Drupal\Core\Render\RendererInterface $renderer
* The renderer.
* @param \Drupal\Core\Config\TypedConfigManagerInterface $typed_config_manager
* The typed config manager.
*/
public function __construct(ConfigFactoryInterface $config_factory, EntityTypeManagerInterface $entity_type_manager, RendererInterface $renderer) {
parent::__construct($config_factory);
public function __construct(ConfigFactoryInterface $config_factory, EntityTypeManagerInterface $entity_type_manager, RendererInterface $renderer, TypedConfigManagerInterface $typed_config_manager) {
parent::__construct($config_factory, $typed_config_manager);
$this->entityTypeManager = $entity_type_manager;
$this->renderer = $renderer;
}
Expand All @@ -72,7 +75,8 @@ public static function create(ContainerInterface $container) {
return new static(
$container->get('config.factory'),
$container->get('entity_type.manager'),
$container->get('renderer')
$container->get('renderer'),
$container->get('config.typed')
);
}

Expand Down
15 changes: 12 additions & 3 deletions src/Form/DeveloperAttributesSettingsForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
namespace Drupal\apigee_edge\Form;

use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Config\TypedConfigManagerInterface;
use Drupal\Core\Entity\EntityFieldManagerInterface;
use Drupal\Core\Form\ConfigFormBase;
use Drupal\Core\Form\FormStateInterface;
Expand Down Expand Up @@ -67,9 +68,11 @@ class DeveloperAttributesSettingsForm extends ConfigFormBase {
* Field storage format manager service.
* @param \Drupal\apigee_edge\FieldAttributeConverter $field_attribute_converter
* Field name to attribute name converted service.
* @param \Drupal\Core\Config\TypedConfigManagerInterface $typed_config_manager
* The typed config manager.
*/
public function __construct(ConfigFactoryInterface $config_factory, EntityFieldManagerInterface $entity_field_manager, FieldStorageFormatManagerInterface $field_storage_format_manager, FieldAttributeConverter $field_attribute_converter) {
parent::__construct($config_factory);
public function __construct(ConfigFactoryInterface $config_factory, EntityFieldManagerInterface $entity_field_manager, FieldStorageFormatManagerInterface $field_storage_format_manager, FieldAttributeConverter $field_attribute_converter, TypedConfigManagerInterface $typed_config_manager) {
parent::__construct($config_factory, $typed_config_manager);
$this->fieldAttributeConverter = $field_attribute_converter;
$this->entityFieldManager = $entity_field_manager;
$this->fieldStorageFormatManager = $field_storage_format_manager;
Expand All @@ -79,7 +82,13 @@ public function __construct(ConfigFactoryInterface $config_factory, EntityFieldM
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static($container->get('config.factory'), $container->get('entity_field.manager'), $container->get('plugin.manager.apigee_field_storage_format'), $container->get('apigee_edge.converter.field_attribute'));
return new static(
$container->get('config.factory'),
$container->get('entity_field.manager'),
$container->get('plugin.manager.apigee_field_storage_format'),
$container->get('apigee_edge.converter.field_attribute'),
$container->get('config.typed')
);
}

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

use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Config\TypedConfigManagerInterface;
use Drupal\Core\Entity\EntityDisplayRepositoryInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
Expand Down Expand Up @@ -85,9 +86,11 @@ class EdgeEntityDisplaySettingsForm extends ConfigFormBase implements BaseFormId
* The module handler.
* @param \Drupal\Core\Routing\RouteMatchInterface $route_match
* The route match.
* @param \Drupal\Core\Config\TypedConfigManagerInterface $typed_config_manager
* The typed config manager.
*/
public function __construct(ConfigFactoryInterface $config_factory, EntityTypeManagerInterface $entity_type_manager, EntityDisplayRepositoryInterface $entity_display_repository, ModuleHandlerInterface $module_handler, RouteMatchInterface $route_match) {
parent::__construct($config_factory);
public function __construct(ConfigFactoryInterface $config_factory, EntityTypeManagerInterface $entity_type_manager, EntityDisplayRepositoryInterface $entity_display_repository, ModuleHandlerInterface $module_handler, RouteMatchInterface $route_match, TypedConfigManagerInterface $typed_config_manager) {
parent::__construct($config_factory, $typed_config_manager);
$this->entityTypeManager = $entity_type_manager;
$this->moduleHandler = $module_handler;
$this->entityDisplayRepository = $entity_display_repository;
Expand All @@ -103,7 +106,8 @@ public static function create(ContainerInterface $container) {
$container->get('entity_type.manager'),
$container->get('entity_display.repository'),
$container->get('module_handler'),
$container->get('current_route_match')
$container->get('current_route_match'),
$container->get('config.typed')
);
}

Expand Down

0 comments on commit 9f0de7a

Please sign in to comment.