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

Issue #3290984 by yas, sekinet, Xiaohua Guan, Masami, kumikoono: Refactor the...

Issue #3290984 by yas, sekinet, Xiaohua Guan, Masami, kumikoono: Refactor the source code based on Drupal best practices (3) (t() function)
parent b823335b
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -2607,7 +2607,9 @@ function aws_cloud_form_cloud_config_aws_cloud_edit_form_alter(array &$form, For
  $form['#validate'][] = 'aws_cloud_form_cloud_config_aws_cloud_check_iam_permissions_validate';

  $max_region_code_length = CloudConfigInterface::MAX_NAME_LENGTH;
  $form['name']['widget'][0]['value']['#description'] = "The name of the cloud service provider. The maximum number of characters allowed in the name is {$max_region_code_length}.";
  $form['name']['widget'][0]['value']['#description'] = t('The name of the cloud service provider. The maximum number of characters allowed in the name is %max_region_code_length.', [
    '%max_region_code_length' => $max_region_code_length,
  ]);
  $form['name']['widget'][0]['value']['#maxlength'] = $max_region_code_length;

  aws_cloud_form_cloud_config_aws_cloud_form_common_alter($form, $form_state, $form_id);
+1 −1
Original line number Diff line number Diff line
@@ -87,7 +87,7 @@ class AwsEntityUpdateSubscriber implements EventSubscriberInterface {
      $this->ec2Service->deleteLaunchTemplate($params);
    }
    catch (\Exception $e) {
      throw new Ec2ServiceException($this->t('Failed to delete AWS launch template.'));
      throw new Ec2ServiceException('Failed to delete AWS launch template.');
    }

    return TRUE;
+2 −2
Original line number Diff line number Diff line
@@ -714,7 +714,7 @@ class Ec2Service extends CloudServiceBase implements Ec2ServiceInterface {
    if (!empty($params['DryRun']) && count($params) === 1) {
      $availability_zones = $this->getAvailabilityZones();
      if (empty($availability_zones)) {
        throw new Ec2ServiceException($this->t('Failed to test createVolume() on getting a required parameter, AvailabilityZone, by calling getAvailabilityZones().'),
        throw new Ec2ServiceException('Failed to test createVolume() on getting a required parameter, AvailabilityZone, by calling getAvailabilityZones().',
          'createVolume', 'UnauthorizedOperation');
      }
      // Set required parameters if missing.
@@ -740,7 +740,7 @@ class Ec2Service extends CloudServiceBase implements Ec2ServiceInterface {
    if (!empty($params['DryRun']) && count($params) === 1) {
      $volumes = $this->describeVolumes([], $credentials);
      if (empty($volumes['Volumes'][0]['VolumeId'])) {
        throw new Ec2ServiceException($this->t('Failed to test createSnapshot() on getting a required parameter, VolumeId, by calling describeVolumes().'),
        throw new Ec2ServiceException('Failed to test createSnapshot() on getting a required parameter, VolumeId, by calling describeVolumes().',
          'createSnapshot', 'UnauthorizedOperation');
      }
      $params['VolumeId'] = $volumes['Volumes'][0]['VolumeId'];
+3 −1
Original line number Diff line number Diff line
@@ -364,7 +364,9 @@ function k8s_form_cloud_config_k8s_form_common_alter(array &$form, FormStateInte
    }

    $max_region_code_length = CloudConfigInterface::MAX_NAME_LENGTH;
    $form['name']['widget'][0]['value']['#description'] = "The name of the cloud service provider. The maximum number of characters allowed in the name is {$max_region_code_length}.";
    $form['name']['widget'][0]['value']['#description'] = t('The name of the cloud service provider. The maximum number of characters allowed in the name is %max_region_code_length.', [
      '%max_region_code_length' => $max_region_code_length,
    ]);
    $form['name']['widget'][0]['value']['#maxlength'] = $max_region_code_length;

    k8s_cloud_config_fieldsets($form);
+1 −1
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ class K8sNamespaceCreateForm extends K8sContentForm {
    $form['namespace']['name'] = [
      '#type'          => 'textfield',
      '#title'         => $this->t('Name'),
      '#description' => "A lowercase RFC 1123 label must consist of lower case alphanumeric characters or '-', and must start and end with an alphanumeric character (e.g. 'my-name', or '123-abc').",
      '#description' => $this->t("A lowercase RFC 1123 label must consist of lower case alphanumeric characters or '-', and must start and end with an alphanumeric character (e.g. 'my-name', or '123-abc')."),
      '#maxlength'     => 255,
      '#size'          => 60,
      '#required'      => TRUE,
Loading