Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes Drupal 11 compatibility issues #1099

Open
wants to merge 4 commits into
base: 4.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apigee_edge.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: Apigee Drupal integration.
package: Apigee

type: module
core_version_requirement: ^10
core_version_requirement: ^10.3 || ^11

dependencies:
- drupal:file
Expand All @@ -16,4 +16,4 @@ dependencies:

configure: apigee_edge.settings

php: 8.1
php: 8.3
2 changes: 1 addition & 1 deletion modules/apigee_edge_actions/apigee_edge_actions.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Apigee Edge Actions
description: Rules integration for Apigee Edge.
package: Apigee (Experimental)
type: module
core_version_requirement: ^10
core_version_requirement: ^10.3 || ^11
configure: entity.rules_reaction_rule.collection
dependencies:
- apigee_edge:apigee_edge
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ name: Apigee Edge Actions Debug
description: Logs debug information for Apigee Edge Actions.
package: Apigee (Experimental)
type: module
core_version_requirement: ^10
core_version_requirement: ^10.3 || ^11
dependencies:
- apigee_edge_actions:apigee_edge_actions
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Apigee Edge Actions Examples
description: Example rules for Apigee Edge.
package: Apigee (Experimental)
type: module
core_version_requirement: ^10
core_version_requirement: ^10.3 || ^11
configure: entity.rules_reaction_rule.collection
dependencies:
- apigee_edge_actions:apigee_edge_actions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ description: Role based access control over view operation on API products.
package: Apigee

type: module
core_version_requirement: ^10
core_version_requirement: ^10.3 || ^11

dependencies:
- apigee_edge:apigee_edge

configure: apigee_edge.settings.developer.api_product_access

php: "8.1"
php: "8.3"
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
admin:
apigee_edge_apiproduct_rbac.admin:
version: 1.1
css:
theme:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ function apigee_edge_apiproduct_rbac_form_apigee_edge_api_product_access_control
'#value' => $product_names,
];

$form['#attached']['library'][] = 'apigee_edge_apiproduct_rbac/admin';
$form['#attached']['library'][] = 'apigee_edge_apiproduct_rbac/apigee_edge_apiproduct_rbac.admin';
$form['#submit'][] = 'apigee_edge_apiproduct_rbac_form_apigee_edge_api_product_access_control_form_submit';
}

Expand Down
4 changes: 2 additions & 2 deletions modules/apigee_edge_debug/apigee_edge_debug.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ description: Debug helper for Apigee Edge Drupal integration.
package: Apigee

type: module
core_version_requirement: ^10
core_version_requirement: ^10.3 || ^11

dependencies:
- apigee_edge:apigee_edge

configure: apigee_edge_debug.settings

php: "8.1"
php: "8.3"
4 changes: 2 additions & 2 deletions modules/apigee_edge_teams/apigee_edge_teams.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: Provides shared app functionality by allowing developers to be orga
package: Apigee

type: module
core_version_requirement: ^10
core_version_requirement: ^10.3 || ^11

dependencies:
- apigee_edge:apigee_edge
Expand All @@ -12,4 +12,4 @@ dependencies:

configure: apigee_edge_teams.settings.team

php: "8.1"
php: "8.3"
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,6 @@ display:
default_argument_type: fixed
default_argument_options:
argument: ''
default_argument_skip_url: false
summary_options:
base_path: ''
count: true
Expand Down Expand Up @@ -767,7 +766,6 @@ display:
default_argument_type: user
default_argument_options:
user: false
default_argument_skip_url: false
summary_options:
base_path: ''
count: true
Expand Down
2 changes: 1 addition & 1 deletion modules/apigee_edge_teams/src/TeamPermissionHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ protected function sortPermissions(array $all_permissions = []) {
protected function getModuleNames(): array {
$modules = [];
foreach (array_keys($this->moduleHandler->getModuleList()) as $module) {
$modules[$module] = $this->moduleHandler->getName($module);
$modules[$module] = \Drupal::service('extension.list.module')->getName($module);
}
asort($modules);
return $modules;
Expand Down
6 changes: 3 additions & 3 deletions src/Element/ApigeeEntityListElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@

use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Render\Element\RenderElement;
use Drupal\Core\Render\Element\RenderElementBase;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
* Provides an element for listing Apigee entities.
*
* @RenderElement("apigee_entity_list")
* @RenderElementBase("apigee_entity_list")
*/
class ApigeeEntityListElement extends RenderElement implements ContainerFactoryPluginInterface {
class ApigeeEntityListElement extends RenderElementBase implements ContainerFactoryPluginInterface {

/**
* The entity type manager.
Expand Down
6 changes: 3 additions & 3 deletions src/Element/ApigeeSecret.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@

namespace Drupal\apigee_edge\Element;

use Drupal\Core\Render\Element\RenderElement;
use Drupal\Core\Render\Element\RenderElementBase;

/**
* Provides a secret element.
*
* @RenderElement("apigee_secret")
* @RenderElementBase("apigee_secret")
*/
class ApigeeSecret extends RenderElement {
class ApigeeSecret extends RenderElementBase {

/**
* {@inheritdoc}
Expand Down
6 changes: 3 additions & 3 deletions src/Element/AppCredentialElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@

namespace Drupal\apigee_edge\Element;

use Drupal\Core\Render\Element\RenderElement;
use Drupal\Core\Render\Element\RenderElementBase;

/**
* Provides an app credential element.
*
* @RenderElement("app_credential")
* @RenderElementBase("app_credential")
*/
class AppCredentialElement extends RenderElement {
class AppCredentialElement extends RenderElementBase {

/**
* {@inheritdoc}
Expand Down
6 changes: 3 additions & 3 deletions src/Element/AppCredentialProductListElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@

namespace Drupal\apigee_edge\Element;

use Drupal\Core\Render\Element\RenderElement;
use Drupal\Core\Render\Element\RenderElementBase;

/**
* Provides a product listing element for app credentials.
*
* @RenderElement("app_credential_product_list")
* @RenderElementBase("app_credential_product_list")
*/
class AppCredentialProductListElement extends RenderElement {
class AppCredentialProductListElement extends RenderElementBase {

/**
* {@inheritdoc}
Expand Down
6 changes: 3 additions & 3 deletions src/Element/StatusPropertyElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@

namespace Drupal\apigee_edge\Element;

use Drupal\Core\Render\Element\RenderElement;
use Drupal\Core\Render\Element\RenderElementBase;

/**
* Provides a status property element.
*
* @RenderElement("status_property")
* @RenderElementBase("status_property")
*/
class StatusPropertyElement extends RenderElement {
class StatusPropertyElement extends RenderElementBase {

/**
* Indicator status configuration id: OK.
Expand Down
2 changes: 1 addition & 1 deletion src/Entity/FieldableEdgeEntityBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ abstract class FieldableEdgeEntityBase extends EdgeEntityBase implements Fieldab
/**
* {@inheritdoc}
*/
public function __sleep() {
public function __sleep(): array {
$this->fields = [];
$this->fieldDefinitions = NULL;
return parent::__sleep();
Expand Down
2 changes: 1 addition & 1 deletion src/Entity/ListBuilder/AppListBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ protected function buildWarningRow(AppInterface $app, array &$rows) {
$url = Url::fromUserInput($this->requestStack->getCurrentRequest()->getRequestUri(), $link_options);
$link = Link::fromTextAndUrl($this->t('<span class="ui-icon-triangle-1-e ui-icon"></span><span class="text">Show details</span>'), $url);
$build['warning-toggle'] = $link->toRenderable();
$rows[$info_row_css_id]['data']['status']['data'] = $this->renderer->renderPlain($build);
$rows[$info_row_css_id]['data']['status']['data'] = $this->renderer->renderInIsolation($build);
$row['data']['info'] = [
'colspan' => count($this->buildHeader()),
];
Expand Down
3 changes: 2 additions & 1 deletion src/MemoryCacheFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

namespace Drupal\apigee_edge;

use Drupal\Component\Datetime\Time;
use Drupal\Core\Cache\MemoryCache\MemoryCache;
use Drupal\Core\Cache\MemoryCache\MemoryCacheInterface;

Expand Down Expand Up @@ -65,7 +66,7 @@ public function __construct(?string $prefix = NULL) {
public function get($bin): MemoryCacheInterface {
$bin = "{$this->prefix}_{$bin}";
if (!isset($this->bins[$bin])) {
$this->bins[$bin] = new MemoryCache();
$this->bins[$bin] = new MemoryCache(new Time());
}
return $this->bins[$bin];
}
Expand Down
3 changes: 2 additions & 1 deletion src/OauthTokenFileStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use Drupal\Component\Serialization\Json;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\File\Exception\FileException;
use Drupal\Core\File\FileExists;
use Drupal\Core\File\FileSystemInterface;
use Drupal\Core\Logger\LoggerChannelInterface;
use Drupal\apigee_edge\Exception\OauthTokenStorageException;
Expand Down Expand Up @@ -172,7 +173,7 @@ public function saveToken(array $data): void {
try {
$this->checkRequirements();
// Write the obfuscated token data to a private file.
$this->fileSystem->saveData(base64_encode(Json::encode($data)), $this->tokenFilePath, FileSystemInterface::EXISTS_REPLACE);
$this->fileSystem->saveData(base64_encode(Json::encode($data)), $this->tokenFilePath, FileExists::Replace);
}
catch (FileException $e) {
$this->logger->critical('Error saving OAuth token file.');
Expand Down
3 changes: 2 additions & 1 deletion src/Plugin/KeyProvider/PrivateFileKeyProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
namespace Drupal\apigee_edge\Plugin\KeyProvider;

use Drupal\Core\File\Exception\FileException;
use Drupal\Core\File\FileExists;
use Drupal\Core\File\FileSystemInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Utility\Error;
Expand Down Expand Up @@ -143,7 +144,7 @@ public function setKeyValue(KeyInterface $key, $key_value) {
try {
// Save the token data.
return $this->getFileSystem()
->saveData($key_value, $file_uri, FileSystemInterface::EXISTS_REPLACE);
->saveData($key_value, $file_uri, FileExists::Replace);
}
catch (FileException $e) {
return FALSE;
Expand Down
2 changes: 1 addition & 1 deletion tests/modules/apigee_edge_test/apigee_edge_test.info.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: 'Apigee Edge Testing'
type: module
description: 'Support module for the Apigee Edge tests.'
core_version_requirement: ^10
core_version_requirement: ^10.3 || ^11
package: Testing

dependencies:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: 'Apigee Edge Testing: App keys'
type: module
description: 'Support module for the Apigee Edge tests: Mocks app key generation via a 3rd party service.'
core_version_requirement: ^10
core_version_requirement: ^10.3 || ^11
package: Testing

dependencies:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ description: Helpers and an API middleware used for testing.
package: Apigee

type: module
core_version_requirement: ^10
core_version_requirement: ^10.3 || ^11

dependencies:
- apigee_edge:apigee_edge

php: "8.0"
php: "8.3"
3 changes: 2 additions & 1 deletion tests/src/Kernel/OauthTokenFileStorageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

use Drupal\Component\Serialization\Json;
use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Core\File\FileExists;
use Drupal\Core\File\FileSystemInterface;
use Drupal\KernelTests\KernelTestBase;
use Drupal\apigee_edge\Exception\OauthTokenStorageException;
Expand Down Expand Up @@ -183,7 +184,7 @@ public function testStaticCaching() {
$stored_token['access_token'] = mb_strtolower($this->randomMachineName(32));
\Drupal::service('file_system')->saveData(
base64_encode(Json::encode($stored_token)),
$this->tokenFileUri(), FileSystemInterface::EXISTS_REPLACE);
$this->tokenFileUri(), FileExists::Replace);

// Make sure the cached version is still returned.
$this->assertSame($access_token, $storage->getAccessToken());
Expand Down
Loading