Skip to content

Commit

Permalink
3484814: Drupal 11 compatibility for version 3.4 by @albertosilva
Browse files Browse the repository at this point in the history
  • Loading branch information
Luigisa committed Oct 31, 2024
1 parent 712bd73 commit f5b2062
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 16 deletions.
2 changes: 1 addition & 1 deletion graphql.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ type: module
description: "Base module for integrating GraphQL with Drupal."
package: GraphQL
configure: graphql.config_page
core_version_requirement: ^9 || ^10
core_version_requirement: ^9 || ^10 || ^11
2 changes: 1 addition & 1 deletion modules/graphql_core/graphql_core.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: GraphQL Core
type: module
description: "Provides type system plugins and derivers on behalf of core modules."
package: GraphQL
core_version_requirement: ^9 || ^10
core_version_requirement: ^9 || ^10 || ^11
dependencies:
- graphql:graphql
- drupal:path_alias
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: "GraphQL Test: Blocks"
type: module
package: Testing
core_version_requirement: ^9 || ^10
core_version_requirement: ^9 || ^10 || ^11
hidden: TRUE
dependencies:
- drupal:block
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: GraphQL Breadcrumbs test
type: module
description: "Test for breadcrumbs."
package: Testing
core_version_requirement: ^9 || ^10
core_version_requirement: ^9 || ^10 || ^11
hidden: TRUE
dependencies:
- graphql:graphql_core
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ type: module
name: GraphQL Context Test
description: Test contexts in graphql schema.
package: Testing
core_version_requirement: ^9 || ^10
core_version_requirement: ^9 || ^10 || ^11
hidden: TRUE
dependencies:
- graphql:graphql_core
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ type: module
name: GraphQL Requests Test
description: Dummy callbacks for internal request testing.
package: Testing
core_version_requirement: ^9 || ^10
core_version_requirement: ^9 || ^10 || ^11
hidden: TRUE
dependencies:
- graphql:graphql_core
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: "GraphQL Tests: Menu"
type: module
package: Testing
core_version_requirement: ^9 || ^10
core_version_requirement: ^9 || ^10 || ^11
hidden: TRUE
dependencies:
- drupal:system
18 changes: 15 additions & 3 deletions src/Controller/SchemaOverviewController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Drupal\graphql\Controller;

use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Drupal\Core\Extension\ModuleExtensionList;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\graphql\Plugin\SchemaPluginManager;
Expand All @@ -26,12 +27,20 @@ class SchemaOverviewController implements ContainerInjectionInterface {
*/
protected $moduleHandler;

/**
* The module extension list service.
*
* @var \Drupal\Core\Extension\ModuleExtensionList
*/
protected $moduleExtensionList;

/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static(
$container->get('module_handler'),
$container->get('extension.list.module'),
$container->get('plugin.manager.graphql.schema')
);
}
Expand All @@ -40,12 +49,15 @@ public static function create(ContainerInterface $container) {
* SchemaOverviewController constructor.
*
* @param \Drupal\Core\Extension\ModuleHandlerInterface $moduleHandler
* The module handler srevice.
* The module handler service.
* @param \Drupal\Core\Extension\ModuleExtensionList $moduleExtensionList
* The module extension list service
* @param \Drupal\graphql\Plugin\SchemaPluginManager $schemaManager
* The schema plugin manager service.
*/
public function __construct(ModuleHandlerInterface $moduleHandler, SchemaPluginManager $schemaManager) {
public function __construct(ModuleHandlerInterface $moduleHandler, ModuleExtensionList $moduleExtensionList, SchemaPluginManager $schemaManager) {
$this->schemaManager = $schemaManager;
$this->moduleExtensionList = $moduleExtensionList;
$this->moduleHandler = $moduleHandler;
}

Expand Down Expand Up @@ -74,7 +86,7 @@ public function listSchemas() {
];

$table["schema:$key"]['provider'] = [
'#plain_text' => $this->moduleHandler->getName($definition['provider']),
'#plain_text' => $this->moduleExtensionList->getName($definition['provider']),
];

$table["schema:$key"]['operations'] = $this->buildOperations($key, $definition);
Expand Down
4 changes: 2 additions & 2 deletions src/Plugin/GraphQL/Traits/DescribablePluginTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ trait DescribablePluginTrait {
* @return null|string
*/
protected function buildDescription($definition) {
if (!empty($definition['description'])) {
return (string) $definition['description'];
if (!empty($definition['description']) && !is_null($definition['description'])) {
return (string) ($definition['description']);
}

return NULL;
Expand Down
2 changes: 1 addition & 1 deletion tests/modules/graphql_enum_test/graphql_enum_test.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ type: module
name: GraphQL Enumeration Test
description: Test enumeration plugins.
package: Testing
core_version_requirement: ^9 || ^10
core_version_requirement: ^9 || ^10 || ^11
hidden: TRUE
dependencies:
- graphql:graphql
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ type: module
name: GraphQL Override Test
description: Test plugin overrides in graphql schema.
package: Testing
core_version_requirement: ^9 || ^10
core_version_requirement: ^9 || ^10 || ^11
hidden: TRUE
dependencies:
- graphql:graphql_plugin_test
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ type: module
name: GraphQL Plugin Test
description: Test plugin based graphql schema.
package: Testing
core_version_requirement: ^9 || ^10
core_version_requirement: ^9 || ^10 || ^11
hidden: TRUE
dependencies:
- graphql:graphql
2 changes: 1 addition & 1 deletion tests/modules/graphql_test/graphql_test.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ type: module
name: GraphQL Test
description: Provides a default schema plugin for testing.
package: Testing
core_version_requirement: ^9 || ^10
core_version_requirement: ^9 || ^10 || ^11
hidden: TRUE
dependencies:
- graphql:graphql

0 comments on commit f5b2062

Please sign in to comment.