amit.drupal created an issue. See original summary.
@nileshaddweb
Thank you for the refactoring.
+++ b/modules/cloud_service_providers/aws_cloud/src/Form/Ec2/ElasticIpAssociateForm.php @@ -202,13 +203,27 @@ class ElasticIpAssociateForm extends AwsDeleteForm { + $instance->getName() !== $instance->getInstanceId() ? $this->t('@instance_name (@instance_id)', [ + '@instance_name' => $instance->getName(), + '@instance_id' => $instance_id, + ]) : $instance_id
Can you refactor the code style like this?
$instance->getName() !== $instance->getInstanceId() ? $this->t('@instance_name (@instance_id)', [ '@instance_name' => $instance->getName(), '@instance_id' => $instance_id, ]) : $instance_id );
* Please check the coding standard.
+++ b/modules/cloud_service_providers/aws_cloud/src/Form/Ec2/ElasticIpAssociateForm.php @@ -222,11 +237,13 @@ class ElasticIpAssociateForm extends AwsDeleteForm { + $message = $this->t('Elastic IP @ip_address associated with @private_ip for instance: @instance_id', [ '@ip_address' => $this->entity->getPublicIp(), '@instance' => !empty($instance) ? $instance->getName() : 'N/A', '@private_ip' => $private_ip, + '@instance_id' => Markup::create($instance_link['#markup']), ]);
I guess we don't need '@instance' any longer?
'@instance'
Thank you for the update. Interdiff is helpful to find out your fixes. I'll merge the patch to 8.x-1.x and 8.x-2.x and close this issue as Fixed.
8.x-1.x
8.x-2.x
Fixed
Issue #3119979 by nilesh.addweb, amit.drupal, yas: Refactor to add a...
$entity
$instance_id
public function submitForm(array &$form, FormStateInterface $form_state) { $this->ec2Service->setCloudContext($this->entity->getCloudContext()); $entity = $this->entity; // Determine if elastic_ip is attaching to instance or network_interface. if ($form_state->getValue('resource_type') === 'instance') { $get_instance_id = $form_state->getValue('instance_id'); $private_ip = $form_state->getValue('instance_private_ip'); if ($instance_id !== -1) { $instance = Instance::load($get_instance_id); $instance_id = $instance->getInstanceId();
Please fix the issues, create and test a patch.
@yas I updated patch as per your comment. Please check.
Do we really need to introduce a new variable $get_instance_id?
$get_instance_id
$get_instance_id = $form_state->getValue('instance_id'); $private_ip = $form_state->getValue('instance_private_ip'); if ($get_instance_id !== -1) { $instance = Instance::load($get_instance_id); $instance_id = $instance->getInstanceId(); $instance_link = $this->entityLinkRenderer->renderViewElement(
Can we write like this?
$instance_id = $form_state->getValue('instance_id'); $private_ip = $form_state->getValue('instance_private_ip'); if ($instance_id !== -1) { $instance = Instance::load($get_instance_id); $instance_link = $this->entityLinkRenderer->renderViewElement(
Let's change like this:
FROM:
TO:
$entity_id = $form_state->getValue('instance_id'); $private_ip = $form_state->getValue('instance_private_ip'); if ($entity_id !== -1) { $instance = Instance::load($entity_id); $instance_id = $instance->getInstanceId(); $instance_link = $this->entityLinkRenderer->renderViewElement(
Thank you for the update. I tested the patch and looks good to me now. I'll merge the patch to 8.x-1.x and 8.x-2.x and close this issue as Fixed.
Issue #3119979 by nilesh.addweb, yas: Hotfix - Refactor to add a link to...
Automatically closed - issue fixed for 2 weeks with no activity.
Comments
Comment #2
amit.drupal commentedComment #3
amit.drupal commentedComment #4
yoftahe.addweb commentedComment #5
yas@nileshaddweb
Thank you for the refactoring.
Can you refactor the code style like this?
* Please check the coding standard.
I guess we don't need
'@instance'any longer?Comment #6
yasComment #7
yoftahe.addweb commentedComment #8
yas@nileshaddweb
Thank you for the update. Interdiff is helpful to find out your fixes. I'll merge the patch to
8.x-1.xand8.x-2.xand close this issue asFixed.Comment #11
yasComment #12
yas@nileshaddweb
$entityis unused$instance_idis undefinedPlease fix the issues, create and test a patch.
Comment #13
yoftahe.addweb commented@yas I updated patch as per your comment. Please check.
Comment #14
yas@nileshaddweb
Do we really need to introduce a new variable
$get_instance_id?Can we write like this?
Comment #15
yas@nileshaddweb
Let's change like this:
FROM:
TO:
Comment #16
yoftahe.addweb commented@yas I updated patch as per your comment. Please check.
Comment #17
yas@nileshaddweb
Thank you for the update. I tested the patch and looks good to me now. I'll merge the patch to
8.x-1.xand8.x-2.xand close this issue asFixed.Comment #20
yas