cloud-8.x-2.0-beta1/modules/cloud_service_providers/aws_cloud/src/Form/Ec2/ImageDeleteMultipleForm.php
modules/cloud_service_providers/aws_cloud/src/Form/Ec2/ImageDeleteMultipleForm.php
<?php
namespace Drupal\aws_cloud\Form\Ec2;
use Drupal\cloud\Entity\CloudContentEntityBase;
/**
* Provides an entities deletion confirmation form.
*/
class ImageDeleteMultipleForm extends AwsCloudDeleteMultipleForm {
/**
* {@inheritdoc}
*/
protected function processCloudResource(CloudContentEntityBase $entity) {
$this->cloudConfigPluginManager->setCloudContext($entity->getCloudContext());
$account_id = $this->cloudConfigPluginManager->loadConfigEntity()->get('field_account_id')->value;
if ($entity->getAccountId() != $account_id) {
return TRUE;
}
$this->ec2Service->setCloudContext($entity->getCloudContext());
return $this->ec2Service->deregisterImage(
['ImageId' => $entity->getImageId()]
) != NULL;
}
}
