Skip to content
Snippets Groups Projects
Commit 212652a3 authored by yas's avatar yas
Browse files

Converted the array syntax from array(...) to [...]

parent 0cea8eb8
No related branches found
No related tags found
No related merge requests found
Showing
with 421 additions and 421 deletions
......@@ -19,11 +19,11 @@ class ElasticIpViewsData extends EntityViewsData implements EntityViewsDataInter
public function getViewsData() {
$data = parent::getViewsData();
$data['aws_cloud_elastic_ip']['table']['base'] = array(
$data['aws_cloud_elastic_ip']['table']['base'] = [
'field' => 'id',
'title' => t('AWS Cloud Elastic IP'),
'help' => t('The AWC Cloud Elastic IP entity ID.'),
);
];
return $data;
}
......
......@@ -68,9 +68,9 @@ class Image extends ContentEntityBase implements ImageInterface {
*/
public static function preCreate(EntityStorageInterface $storage_controller, array &$values) {
parent::preCreate($storage_controller, $values);
$values += array(
$values += [
'user_id' => \Drupal::currentUser()->id(),
);
];
}
/**
......@@ -307,16 +307,16 @@ class Image extends ContentEntityBase implements ImageInterface {
$fields['name'] = BaseFieldDefinition::create('string')
->setLabel(t('Name'))
->setDescription(t('The name of the AwsCloudEc2Image entity.'))
->setSettings(array(
->setSettings([
'default_value' => '',
'max_length' => 255,
'text_processing' => 0,
))
->setDisplayOptions('view', array(
])
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
/*
->setDisplayOptions('form', array(
'type' => 'string_textfield',
......@@ -330,132 +330,132 @@ class Image extends ContentEntityBase implements ImageInterface {
$fields['image_id'] = BaseFieldDefinition::create('string')
->setLabel(t('AMI ID'))
->setDescription(t('The Amazon Machine Image (AMI) ID is used to uniquely identify an AMI'))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['instance_id'] = BaseFieldDefinition::create('string')
->setLabel(t('Instance ID'))
->setDescription(t('The Amazon Machine Image (AMI) ID is used to uniquely identify an AMI'))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['status'] = BaseFieldDefinition::create('string')
->setLabel(t('Status'))
->setDescription(t('Specifies whether the AMI is available.'))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['architecture'] = BaseFieldDefinition::create('string')
->setLabel(t('Architecture'))
->setDescription(t('Specifies the architecture of the AMI, e.g. i386 for 32-bit, or x86_64 for 64-bit.'))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['virtualization_type'] = BaseFieldDefinition::create('string')
->setLabel(t('Virtualization Type'))
->setDescription(t('The virtualization type used by this AMI, e.g. Paravirtual or Hardware Virtual Machine (HVM). Instances launched from this AMI will use this type of virtualization.'))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['root_device_name'] = BaseFieldDefinition::create('string')
->setLabel(t('Root Device Name'))
->setDescription(t('System device name that contains the boot volume (e.g. /dev/sda1)'))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['ramdisk_id'] = BaseFieldDefinition::create('string')
->setLabel(t('RAM Disk ID'))
->setDescription(t('The RAM disk associated with the image, if applicable.'))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['product_code'] = BaseFieldDefinition::create('string')
->setLabel(t('Product Codes'))
->setDescription(t('The DevPay and Marketplace product codes associated with the AMI, if applicable.'))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['ami_name'] = BaseFieldDefinition::create('string')
->setLabel(t('AMI Name'))
->setDescription(t('The name of the AMI that was provided during image creation.'))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['source'] = BaseFieldDefinition::create('string')
->setLabel(t('Source'))
->setDescription(t('For AMIs backed by the Amazon instance store, this is the location of the Amazon S3 source manifest. For AMIs backed by Amazon EBS, this is the owner and name of the AMI.'))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['state_reason'] = BaseFieldDefinition::create('string')
->setLabel(t('State Reason'))
->setDescription(t("Displays any provided message regarding an AMI's state change, e.g. pending to failed."))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['platform'] = BaseFieldDefinition::create('string')
->setLabel(t('Platform'))
->setDescription(t('Specifies the operating system (e.g, Windows), if applicable.'))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['image_type'] = BaseFieldDefinition::create('string')
->setLabel(t('Image Type'))
->setDescription(t('Specifies whether this is a machine, kernel, or RAM disk image type.'))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['description'] = BaseFieldDefinition::create('string')
......@@ -465,61 +465,61 @@ class Image extends ContentEntityBase implements ImageInterface {
$fields['root_device_type'] = BaseFieldDefinition::create('string')
->setLabel(t('Root Device Type'))
->setDescription(t('The root volume is either an EBS volume or instance store volume. Instance store volumes do not persist after an instance is terminated.'))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['root_device_type'] = BaseFieldDefinition::create('string')
->setLabel(t('Root Device Type'))
->setDescription(t('The operating system kernel associated with the AMI, if applicable.'))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['kernel_id'] = BaseFieldDefinition::create('string')
->setLabel(t('Kernel ID'))
->setDescription(t('The operating system kernel associated with the AMI, if applicable.'))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['block_devices'] = BaseFieldDefinition::create('string')
->setLabel(t('Block Devices'))
->setDescription(t("Comma separated list of volumes associated with this AMI. Indicates if it's the root device, provides device name, the snapshot ID, capacity of volume in GiB when launched, and whether that volume should be deleted on instance termination."))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['owner'] = BaseFieldDefinition::create('string')
->setLabel(t('Owner'))
->setDescription(t('The AWS account ID of the image owner'))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['visibility'] = BaseFieldDefinition::create('string')
->setLabel(t('Visibility'))
->setDescription(t('The AMI visibility'))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['created'] = BaseFieldDefinition::create('created')
......@@ -542,21 +542,21 @@ class Image extends ContentEntityBase implements ImageInterface {
->setSetting('handler', 'default')
->setDefaultValueCallback('Drupal\node\Entity\Node::getCurrentUserId')
->setTranslatable(TRUE)
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'author',
'weight' => 0,
))
->setDisplayOptions('form', array(
])
->setDisplayOptions('form', [
'type' => 'entity_reference_autocomplete',
'weight' => 5,
'settings' => array(
'settings' => [
'match_operator' => 'CONTAINS',
'size' => '60',
'autocomplete_type' => 'tags',
'placeholder' => '',
),
))
],
])
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
......
......@@ -19,11 +19,11 @@ class ImageViewsData extends EntityViewsData implements EntityViewsDataInterface
public function getViewsData() {
$data = parent::getViewsData();
$data['aws_cloud_image']['table']['base'] = array(
$data['aws_cloud_image']['table']['base'] = [
'field' => 'id',
'title' => t('AWS Cloud Image'),
'help' => t('The AWC Cloud Image entity ID.'),
);
];
return $data;
}
......
......@@ -20,11 +20,11 @@ class InstanceViewsData extends EntityViewsData implements EntityViewsDataInterf
public function getViewsData() {
$data = parent::getViewsData();
$data['aws_cloud_instance']['table']['base'] = array(
$data['aws_cloud_instance']['table']['base'] = [
'field' => 'id',
'title' => t('AWS Cloud Instance'),
'help' => t('The AWC Cloud Instance entity ID.'),
);
];
$data['aws_cloud_instance']['instance_id'] = [
'title' => t('Instance ID'),
......
......@@ -66,9 +66,9 @@ class KeyPair extends ContentEntityBase implements KeyPairInterface {
*/
public static function preCreate(EntityStorageInterface $storage_controller, array &$values) {
parent::preCreate($storage_controller, $values);
$values += array(
$values += [
'user_id' => \Drupal::currentUser()->id(),
);
];
}
/**
......@@ -191,36 +191,36 @@ class KeyPair extends ContentEntityBase implements KeyPairInterface {
$fields['key_pair_name'] = BaseFieldDefinition::create('string')
->setLabel(t('Key Pair Name'))
->setDescription(t('The user-supplied key pair name, which is used to connect to an instance.'))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['key_fingerprint'] = BaseFieldDefinition::create('string')
->setLabel(t('Fingerprint'))
->setDescription(t('The unique fingerprint of the key pair, which can be used to confirm its authenticity.'))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['key_material'] = BaseFieldDefinition::create('string')
->setLabel(t('Key Material'))
->setDescription(t('The key pair material (a private key)'))
->setSettings(array(
->setSettings([
'default_value' => '',
'max_length' => 5120,
'text_processing' => 0,
))
->setDisplayOptions('view', array(
])
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
));
]);
$fields['created'] = BaseFieldDefinition::create('created')
->setLabel(t('Created'))
......@@ -242,21 +242,21 @@ class KeyPair extends ContentEntityBase implements KeyPairInterface {
->setSetting('handler', 'default')
->setDefaultValueCallback('Drupal\node\Entity\Node::getCurrentUserId')
->setTranslatable(TRUE)
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'author',
'weight' => 0,
))
->setDisplayOptions('form', array(
])
->setDisplayOptions('form', [
'type' => 'entity_reference_autocomplete',
'weight' => 5,
'settings' => array(
'settings' => [
'match_operator' => 'CONTAINS',
'size' => '60',
'autocomplete_type' => 'tags',
'placeholder' => '',
),
))
],
])
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
......
......@@ -19,11 +19,11 @@ class KeyPairViewsData extends EntityViewsData implements EntityViewsDataInterfa
public function getViewsData() {
$data = parent::getViewsData();
$data['aws_cloud_key_pair']['table']['base'] = array(
$data['aws_cloud_key_pair']['table']['base'] = [
'field' => 'id',
'title' => t('AWS Cloud KeyPair'),
'help' => t('The AWC Cloud KeyPair entity ID.'),
);
];
return $data;
}
......
......@@ -68,9 +68,9 @@ class NetworkInterface extends ContentEntityBase implements NetworkInterfaceInte
*/
public static function preCreate(EntityStorageInterface $storage_controller, array &$values) {
parent::preCreate($storage_controller, $values);
$values += array(
$values += [
'user_id' => \Drupal::currentUser()->id(),
);
];
}
/**
......@@ -356,16 +356,16 @@ class NetworkInterface extends ContentEntityBase implements NetworkInterfaceInte
$fields['name'] = BaseFieldDefinition::create('string')
->setLabel(t('Name'))
->setDescription(t('The name of the AwsCloudEc2NetworkInterface entity.'))
->setSettings(array(
->setSettings([
'default_value' => '',
'max_length' => 255,
'text_processing' => 0,
))
->setDisplayOptions('view', array(
])
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
/*
->setDisplayOptions('form', array(
'type' => 'string_textfield',
......@@ -379,231 +379,231 @@ class NetworkInterface extends ContentEntityBase implements NetworkInterfaceInte
$fields['network_interface_id'] = BaseFieldDefinition::create('string')
->setLabel(t('Network Interface ID'))
->setDescription(t('The ID of the network interface entity.'))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['vpc_id'] = BaseFieldDefinition::create('string')
->setLabel(t('VPC ID'))
->setDescription(t('The ID of the VPC in which the network interface is located. A VPC is an isolated portion of the AWS cloud.'))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['status'] = BaseFieldDefinition::create('string')
->setLabel(t('Status'))
->setDescription(t('The current status of the network interface; for example, available or in-use.'))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['mac_address'] = BaseFieldDefinition::create('string')
->setLabel(t('Mac Address'))
->setDescription(t("The network interface's Media Access Control (MAC) address."))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['security_groups'] = BaseFieldDefinition::create('string')
->setLabel(t('Security Groups'))
->setDescription(t('The names of the security groups associated with the network interface. You can change the security group associated with the network interface using the Actions menu.'))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['private_dns'] = BaseFieldDefinition::create('string')
->setLabel(t('Private DNS'))
->setDescription(t("The private hostname of the network interface, which resolves to the interface's private IP address."))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['primary_private_ip'] = BaseFieldDefinition::create('string')
->setLabel(t('Primary Private IP'))
->setDescription(t('The primary private IP address of the network interface.'))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['is_primary'] = BaseFieldDefinition::create('boolean')
->setLabel(t('Primary or Not'))
->setDescription(t('The primary private IP address or not.'))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['secondary_private_ips'] = BaseFieldDefinition::create('string')
->setLabel(t('Secondary Private IPs'))
->setDescription(t('Any secondary private IP addresses associated with the network interface, if applicable.'))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['attachment_id'] = BaseFieldDefinition::create('string')
->setLabel(t('Attachment ID'))
->setDescription(t("The ID identifying the network interface's attachment to an instance."))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['attachment_owner'] = BaseFieldDefinition::create('string')
->setLabel(t('Attachment Owner'))
->setDescription(t('The owner of the instance, which may be expressed as an AWS account number.'))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['attachment_status'] = BaseFieldDefinition::create('string')
->setLabel(t('Attachment Status'))
->setDescription(t('The current attachment status of the network interface; for example, attaching, attached, or detaching.'))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['owner_id'] = BaseFieldDefinition::create('string')
->setLabel(t('Owner ID'))
->setDescription(t('The AWS account number of the Elastic IP address owner.'))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['owner'] = BaseFieldDefinition::create('string')
->setLabel(t('Owner ID'))
->setDescription(t('The AWS account number of the network interface creator.'))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['association_id'] = BaseFieldDefinition::create('string')
->setLabel(t('Association ID'))
->setDescription(t('The ID identifying an Elastic IP address association with the network interface.'))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['subnet_id'] = BaseFieldDefinition::create('string')
->setLabel(t('Subnet ID'))
->setDescription(t('The ID of the subnet in which the network interface is located. A subnet is a range of IP addresses in a VPC.'))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['availability_zone'] = BaseFieldDefinition::create('string')
->setLabel(t('Availability Zone'))
->setDescription(t('The Availability Zone in which the network interface is located. Availability Zones are distinct locations within a region.'))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['description'] = BaseFieldDefinition::create('string')
->setLabel(t('Description'))
->setDescription(t('The user-supplied description of the network interface.'))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['public_ips'] = BaseFieldDefinition::create('string')
->setLabel(t('Public IPs'))
->setDescription(t('The public IP address and Elastic IP addresses associated with the network interface, if applicable. An asterisk (*) indicates that the address is associated with the primary private IP address of the network interface.'))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['instance_id'] = BaseFieldDefinition::create('string')
->setLabel(t('Instance ID'))
->setDescription(t('The ID of the instance to which the network interface is attached, if applicable.'))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['device_index'] = BaseFieldDefinition::create('string')
->setLabel(t('Device Index'))
->setDescription(t('If the network interface is attached to an instance, the interface device number to help distinguish it from other attached network interfaces. A primary network interface has a device index of 0.'))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['delete_on_termination'] = BaseFieldDefinition::create('string')
->setLabel(t('Delete on Termination'))
->setDescription(t('If the network interface is attached to an instance, the termination option if the instance is deleted.'))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'boolean',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['allocation_id'] = BaseFieldDefinition::create('string')
->setLabel(t('Allocation ID'))
->setDescription(t('If the network interface is attached to an instance, the termination option if the instance is deleted.'))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['created'] = BaseFieldDefinition::create('created')
......@@ -626,21 +626,21 @@ class NetworkInterface extends ContentEntityBase implements NetworkInterfaceInte
->setSetting('handler', 'default')
->setDefaultValueCallback('Drupal\node\Entity\Node::getCurrentUserId')
->setTranslatable(TRUE)
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'author',
'weight' => 0,
))
->setDisplayOptions('form', array(
])
->setDisplayOptions('form', [
'type' => 'entity_reference_autocomplete',
'weight' => 5,
'settings' => array(
'settings' => [
'match_operator' => 'CONTAINS',
'size' => '60',
'autocomplete_type' => 'tags',
'placeholder' => '',
),
))
],
])
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
......
......@@ -19,11 +19,11 @@ class NetworkInterfaceViewsData extends EntityViewsData implements EntityViewsDa
public function getViewsData() {
$data = parent::getViewsData();
$data['aws_cloud_network_interface']['table']['base'] = array(
$data['aws_cloud_network_interface']['table']['base'] = [
'field' => 'id',
'title' => t('AWS Cloud Network Interface'),
'help' => t('The AWC Cloud Network Interface entity ID.'),
);
];
return $data;
}
......
......@@ -67,9 +67,9 @@ class SecurityGroup extends ContentEntityBase implements SecurityGroupInterface
*/
public static function preCreate(EntityStorageInterface $storage_controller, array &$values) {
parent::preCreate($storage_controller, $values);
$values += array(
$values += [
'user_id' => \Drupal::currentUser()->id(),
);
];
}
/**
......@@ -215,16 +215,16 @@ class SecurityGroup extends ContentEntityBase implements SecurityGroupInterface
$fields['name'] = BaseFieldDefinition::create('string')
->setLabel(t('Name'))
->setDescription(t('The name of the AwsCloudEc2Volume entity.'))
->setSettings(array(
->setSettings([
'default_value' => '',
'max_length' => 255,
'text_processing' => 0,
))
->setDisplayOptions('view', array(
])
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE)
->setRequired(TRUE);
......@@ -232,50 +232,50 @@ class SecurityGroup extends ContentEntityBase implements SecurityGroupInterface
$fields['description'] = BaseFieldDefinition::create('string')
->setLabel(t('Description'))
->setDescription(t('Description of security group.'))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
));
]);
$fields['group_id'] = BaseFieldDefinition::create('string')
->setLabel(t('Group ID'))
->setDescription(t('The ID of your security group.'))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['group_name'] = BaseFieldDefinition::create('string')
->setLabel(t('Group Name'))
->setDescription(t('The name given to your security group.'))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['group_description'] = BaseFieldDefinition::create('string')
->setLabel(t('Group Description'))
->setDescription(t('The description of your security group.'))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['vpc_id'] = BaseFieldDefinition::create('string')
->setLabel(t('VPC ID'))
->setDescription(t('The ID of the virtual private cloud (VPC) the security group belongs to, if applicable. A VPC is an isolated portion of the AWS cloud.'))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['created'] = BaseFieldDefinition::create('created')
......@@ -298,21 +298,21 @@ class SecurityGroup extends ContentEntityBase implements SecurityGroupInterface
->setSetting('handler', 'default')
->setDefaultValueCallback('Drupal\node\Entity\Node::getCurrentUserId')
->setTranslatable(TRUE)
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'author',
'weight' => 0,
))
->setDisplayOptions('form', array(
])
->setDisplayOptions('form', [
'type' => 'entity_reference_autocomplete',
'weight' => 5,
'settings' => array(
'settings' => [
'match_operator' => 'CONTAINS',
'size' => '60',
'autocomplete_type' => 'tags',
'placeholder' => '',
),
))
],
])
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
......
......@@ -23,11 +23,11 @@ class SecurityGroupViewsData extends EntityViewsData implements EntityViewsDataI
public function getViewsData() {
$data = parent::getViewsData();
$data['aws_cloud_security_group']['table']['base'] = array(
$data['aws_cloud_security_group']['table']['base'] = [
'field' => 'id',
'title' => t('AWS Cloud Security Group'),
'help' => t('The AWC Cloud Security Group entity ID.'),
);
];
return $data;
}
......
......@@ -68,9 +68,9 @@ class Snapshot extends ContentEntityBase implements SnapshotInterface {
*/
public static function preCreate(EntityStorageInterface $storage_controller, array &$values) {
parent::preCreate($storage_controller, $values);
$values += array(
$values += [
'user_id' => \Drupal::currentUser()->id(),
);
];
}
/**
......@@ -285,16 +285,16 @@ class Snapshot extends ContentEntityBase implements SnapshotInterface {
$fields['name'] = BaseFieldDefinition::create('string')
->setLabel(t('Name'))
->setDescription(t('The name of the AwsCloudEc2ElasticIp entity.'))
->setSettings(array(
->setSettings([
'default_value' => '',
'max_length' => 255,
'text_processing' => 0,
))
->setDisplayOptions('view', array(
])
->setDisplayOptions('view', [
'label' => 'above',
'type' => 'string',
'weight' => -5,
))
])
/*
->setDisplayOptions('form', array(
'type' => 'string_textfield',
......@@ -303,31 +303,31 @@ class Snapshot extends ContentEntityBase implements SnapshotInterface {
*/
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE)
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['snapshot_id'] = BaseFieldDefinition::create('string')
->setLabel(t('Snapshot ID'))
->setDescription(t('The Snapshot ID.'))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['size'] = BaseFieldDefinition::create('integer')
->setLabel(t('Size'))
->setDescription(t('The size of the snapshot.'))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['description'] = BaseFieldDefinition::create('string')
......@@ -337,115 +337,115 @@ class Snapshot extends ContentEntityBase implements SnapshotInterface {
$fields['status'] = BaseFieldDefinition::create('string')
->setLabel(t('Status'))
->setDescription(t('The current state of the snapshot; for example, pending, completed, or error.'))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['volume_id'] = BaseFieldDefinition::create('string')
->setRequired(TRUE)
->setLabel(t('Volume ID'))
->setDescription(t('The volume ID from which the snapshot was created. A snapshot is a copy of an Amazon EBS volume at a point in time.'))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['started'] = BaseFieldDefinition::create('integer')
->setRequired(TRUE)
->setLabel(t('Started'))
->setDescription(t('The date and time when the snapshot started.'))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['owner'] = BaseFieldDefinition::create('uuid')
->setLabel(t('Owner'))
->setDescription(t('The AWS account ID of the snapshot owner.'))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['progress'] = BaseFieldDefinition::create('string')
->setLabel(t('Progress'))
->setDescription(t('The portion (percentage) of the snapshot that has been created.'))
->setRequired(TRUE)
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['capacity'] = BaseFieldDefinition::create('string')
->setLabel(t('Capacity'))
->setDescription(t('The size of the Amazon EBS volume from which the snapshot was created, in GiB.'))
->setRequired(TRUE)
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['encrypted'] = BaseFieldDefinition::create('string')
->setLabel(t('Encrypted'))
->setDescription(t('Indicates whether the snapshot is encrypted.'))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['product_codes'] = BaseFieldDefinition::create('string')
->setLabel(t('Product Code'))
->setDescription(t('AWS Marketplace product codes associated with the snapshot, if any.'))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['kms_key_id'] = BaseFieldDefinition::create('string')
->setLabel(t('KMS Key ID'))
->setDescription(t('KMS Key ID.'))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['kms_key_aliases'] = BaseFieldDefinition::create('string')
->setLabel(t('KMS Key Aliases'))
->setDescription(t('KMS Key Aliases.'))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['kms_key_arn'] = BaseFieldDefinition::create('string')
->setLabel(t('KMS Key ARN'))
->setDescription(t('KMS Key ARN.'))
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
))
])
->setReadOnly(TRUE);
$fields['changed'] = BaseFieldDefinition::create('changed')
......@@ -464,21 +464,21 @@ class Snapshot extends ContentEntityBase implements SnapshotInterface {
->setSetting('handler', 'default')
->setDefaultValueCallback('Drupal\node\Entity\Node::getCurrentUserId')
->setTranslatable(TRUE)
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'author',
'weight' => 0,
))
->setDisplayOptions('form', array(
])
->setDisplayOptions('form', [
'type' => 'entity_reference_autocomplete',
'weight' => 5,
'settings' => array(
'settings' => [
'match_operator' => 'CONTAINS',
'size' => '60',
'autocomplete_type' => 'tags',
'placeholder' => '',
),
))
],
])
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
......
......@@ -19,11 +19,11 @@ class SnapshotViewsData extends EntityViewsData implements EntityViewsDataInterf
public function getViewsData() {
$data = parent::getViewsData();
$data['aws_cloud_snapshot']['table']['base'] = array(
$data['aws_cloud_snapshot']['table']['base'] = [
'field' => 'id',
'title' => t('AWS Cloud Snapshot'),
'help' => t('The AWC Cloud Snapshot entity ID.'),
);
];
return $data;
}
......
......@@ -19,11 +19,11 @@ class VolumeViewsData extends EntityViewsData implements EntityViewsDataInterfac
public function getViewsData() {
$data = parent::getViewsData();
$data['aws_cloud_volume']['table']['base'] = array(
$data['aws_cloud_volume']['table']['base'] = [
'field' => 'id',
'title' => t('AWS Cloud Volume'),
'help' => t('The AWC Cloud Volume entity ID.'),
);
];
return $data;
}
......
......@@ -19,7 +19,7 @@ class ConfigDeleteForm extends EntityConfirmFormBase {
*/
public function getQuestion() {
$entity = $this->entity;
return $this->t('Are you sure you want to delete %name?', array('%name' => $entity->label()));
return $this->t('Are you sure you want to delete %name?', ['%name' => $entity->label()]);
}
/**
......
......@@ -31,7 +31,7 @@ class ElasticIpCreateForm extends CloudContentForm {
$entity = $this->entity;
$form['cloud_context'] = array(
$form['cloud_context'] = [
'#type' => 'textfield',
'#title' => $this->t('Cloud ID'),
'#maxlength' => 255,
......@@ -42,9 +42,9 @@ class ElasticIpCreateForm extends CloudContentForm {
'#required' => TRUE,
'#weight' => -5,
'#disabled' => TRUE,
);
];
$form['name'] = array(
$form['name'] = [
'#type' => 'textfield',
'#title' => $this->t('Name'),
'#maxlength' => 255,
......@@ -52,18 +52,18 @@ class ElasticIpCreateForm extends CloudContentForm {
'#default_value' => $entity->label(),
'#required' => TRUE,
'#weight' => -5,
);
];
$form['domain'] = array(
$form['domain'] = [
'#type' => 'select',
'#options' => array('standard' => 'standard',
'#options' => ['standard' => 'standard',
'vpc' => 'vpc',
),
],
'#title' => $this->t('Domain (standard | vpc)'),
'#default_value' => 'standard',
'#required' => TRUE,
'#weight' => -5,
);
];
$form['actions'] = $this->actions($form, $form_state, $cloud_context);
......@@ -81,10 +81,10 @@ class ElasticIpCreateForm extends CloudContentForm {
$result = $apiController->createElasticIp($entity);
$status = 'error';
$message = $this->t('The @label "%label" couldn\'t create.', array(
$message = $this->t('The @label "%label" couldn\'t create.', [
'@label' => $entity->getEntityType()->getLabel(),
'%label' => $entity->label(),
));
]);
if (isset($result['PublicIp'])
&& ($entity->setPublicIp($result['PublicIp']))
......@@ -92,11 +92,11 @@ class ElasticIpCreateForm extends CloudContentForm {
&& ($entity->save())) {
$status = 'status';
$message = $this->t('The @label "%label (@elastic_ip)" has been created.', array(
$message = $this->t('The @label "%label (@elastic_ip)" has been created.', [
'@label' => $entity->getEntityType()->getLabel(),
'%label' => $entity->label(),
'@elastic_ip' => $result['PublicIp'],
));
]);
$form_state->setRedirectUrl($entity
->urlInfo('collection')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment