From 9f0de7a185d02d189c03f9c932e1345ae393a71b Mon Sep 17 00:00:00 2001 From: Kedar Khaire Date: Mon, 20 Jan 2025 13:04:11 +0530 Subject: [PATCH] TypedConfigManager new parameter addition to config forms (#1109) --- modules/apigee_edge_debug/src/Form/ConfigForm.php | 13 ++++++++++--- src/Form/ApiProductAccessControlForm.php | 10 +++++++--- src/Form/AppAnalyticsSettingsForm.php | 10 +++++++--- src/Form/AppSettingsForm.php | 10 +++++++--- src/Form/DeveloperAttributesSettingsForm.php | 15 ++++++++++++--- src/Form/EdgeEntityDisplaySettingsForm.php | 10 +++++++--- 6 files changed, 50 insertions(+), 18 deletions(-) diff --git a/modules/apigee_edge_debug/src/Form/ConfigForm.php b/modules/apigee_edge_debug/src/Form/ConfigForm.php index c3bad216b..0339ee179 100644 --- a/modules/apigee_edge_debug/src/Form/ConfigForm.php +++ b/modules/apigee_edge_debug/src/Form/ConfigForm.php @@ -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; @@ -45,9 +46,11 @@ 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; } @@ -55,7 +58,11 @@ public function __construct(ConfigFactoryInterface $config_factory, DebugMessage * {@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') + ); } /** diff --git a/src/Form/ApiProductAccessControlForm.php b/src/Form/ApiProductAccessControlForm.php index f77e32b96..8076163dd 100644 --- a/src/Form/ApiProductAccessControlForm.php +++ b/src/Form/ApiProductAccessControlForm.php @@ -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; @@ -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; } @@ -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') ); } diff --git a/src/Form/AppAnalyticsSettingsForm.php b/src/Form/AppAnalyticsSettingsForm.php index 1468d2b68..d88d5d4e1 100644 --- a/src/Form/AppAnalyticsSettingsForm.php +++ b/src/Form/AppAnalyticsSettingsForm.php @@ -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; @@ -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()); } @@ -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') ); } diff --git a/src/Form/AppSettingsForm.php b/src/Form/AppSettingsForm.php index 6a70d6dfe..795e28e88 100644 --- a/src/Form/AppSettingsForm.php +++ b/src/Form/AppSettingsForm.php @@ -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; @@ -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; } @@ -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') ); } diff --git a/src/Form/DeveloperAttributesSettingsForm.php b/src/Form/DeveloperAttributesSettingsForm.php index fee7a04ba..0537c24e2 100644 --- a/src/Form/DeveloperAttributesSettingsForm.php +++ b/src/Form/DeveloperAttributesSettingsForm.php @@ -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; @@ -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; @@ -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') + ); } /** diff --git a/src/Form/EdgeEntityDisplaySettingsForm.php b/src/Form/EdgeEntityDisplaySettingsForm.php index 73c08c3c8..a4a9670f7 100644 --- a/src/Form/EdgeEntityDisplaySettingsForm.php +++ b/src/Form/EdgeEntityDisplaySettingsForm.php @@ -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; @@ -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; @@ -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') ); }