Commit a634b454 authored by Yas Naoi's avatar Yas Naoi
Browse files

Issue #3294427 by yas: Fix an error to support PHP 8.1: Calling static trait...

Issue #3294427 by yas: Fix an error to support PHP 8.1: Calling static trait method is deprecated (Drupal\cloud\Traits\CloudContentEntityTrait::convertUnderscoreToWhitespace)
parent ef0ec15e
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@ use Drupal\aws_cloud\Service\Ec2\Ec2ServiceInterface;
use Drupal\aws_cloud\Traits\AwsCloudEntityCheckTrait;
use Drupal\cloud\Entity\CloudConfig;
use Drupal\cloud\Plugin\cloud\config\CloudConfigPluginManagerInterface;
use Drupal\cloud\Service\CloudService;
use Drupal\cloud\Service\CloudServiceInterface;
use Drupal\cloud\Traits\CloudContentEntityTrait;
use Drupal\cloud\Traits\CloudResourceTrait;
@@ -703,7 +704,8 @@ class ApiController extends ControllerBase implements ApiControllerInterface {
    }
    $count = $this->getResourceCount(
      $entity_type_id,
      "list {$this->convertUnderscoreToWhitespace($entity_type_id)}",
      // Use a static trait method through CloudService.
      'list ' . CloudService::convertUnderscoreToWhitespace($entity_type_id),
      $params
    );

+3 −1
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@

namespace Drupal\aws_cloud\Form\Ec2;

use Drupal\cloud\Service\CloudService;
use Drupal\cloud\Traits\CloudContentEntityTrait;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Form\FormStateInterface;
@@ -577,7 +578,8 @@ class ElasticIpAssociateForm extends AwsDeleteForm {
    }

    // Get cloud service provider name.
    $cloud_name = self::convertUnderscoreToWhitespace($module_name);
    // Use a static trait method through CloudService.
    $cloud_name = CloudService::convertUnderscoreToWhitespace($module_name);

    if (!$account->hasPermission("view any {$cloud_name} instance")) {
      $query->condition('uid', $account->id());
+3 −1
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@

namespace Drupal\aws_cloud\Form\Ec2;

use Drupal\cloud\Service\CloudService;
use Drupal\cloud\Traits\CloudContentEntityTrait;
use Drupal\Core\Form\FormStateInterface;

@@ -159,7 +160,8 @@ class SnapshotCreateForm extends AwsCloudContentForm {
    ];

    // Get cloud service provider name.
    $cloud_name = self::convertUnderscoreToWhitespace($module_name);
    // Use a static trait method through CloudService.
    $cloud_name = CloudService::convertUnderscoreToWhitespace($module_name);

    if (!$this->currentUser->hasPermission("view any {$cloud_name} volume")) {
      $params['uid'] = $this->currentUser->id();
+3 −1
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@

namespace Drupal\aws_cloud\Form\Ec2;

use Drupal\cloud\Service\CloudService;
use Drupal\Core\Form\FormStateInterface;
use Drupal\cloud\Traits\CloudContentEntityTrait;
use Drupal\Core\StringTranslation\TranslatableMarkup;
@@ -175,7 +176,8 @@ class VolumeAttachForm extends AwsDeleteForm {
    ];

    // Get cloud service provider name.
    $cloud_name = self::convertUnderscoreToWhitespace($module_name);
    // Use a static trait method through CloudService.
    $cloud_name = CloudService::convertUnderscoreToWhitespace($module_name);

    if (!$account->hasPermission("view any {$cloud_name} instance")) {
      $properties['uid'] = $account->id();
+3 −1
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@
namespace Drupal\aws_cloud\Form\Ec2;

use Drupal\aws_cloud\Traits\AwsCloudFormTrait;
use Drupal\cloud\Service\CloudService;
use Drupal\cloud\Traits\CloudContentEntityTrait;
use Drupal\Core\Form\FormStateInterface;

@@ -310,7 +311,8 @@ class VolumeCreateForm extends AwsCloudContentForm {
    ];

    // Get cloud service provider name.
    $cloud_name = self::convertUnderscoreToWhitespace($module_name);
    // Use a static trait method through CloudService.
    $cloud_name = CloudService::convertUnderscoreToWhitespace($module_name);
    if (!$this->currentUser->hasPermission("view any {$cloud_name} snapshot")) {
      $params['uid'] = $this->currentUser->id();
    }
Loading