class AddressPcaAddress in Loqate 2.x
Same name and namespace in other branches
- 8 modules/pca_address/src/Element/AddressPcaAddress.php \Drupal\pca_address\Element\AddressPcaAddress
Provides an advanced PCA address form element.
Usage example:
$form['address'] = [
'#type' => 'pca_address_advanced',
'#pca_fields' => [
[
'element' => PcaAddressElement::ADDRESS_LOOKUP,
],
[
'element' => PcaAddressElement::LINE1,
'field' => PcaAddressField::LINE1,
'mode' => PcaAddressMode::POPULATE,
],
...
],
'#pca_options' => [
'key' => config_key_id, // Defaults to key from config.
'countries' => ['codesList' => 'USA,CAN'],
'setCountryByIP' => false,
...
],
'#show_address_fields' => FALSE,
'#allow_manual_input' => TRUE,
...
];
Plugin annotation
@FormElement("pca_address_advanced");
Hierarchy
- class \Drupal\pca_address\Element\AddressPcaAddress extends \Drupal\address\Element\Address uses PcaAddressElementTrait
Expanded class hierarchy of AddressPcaAddress
See also
\Drupal\address\Element\Address
File
- modules/
pca_address/ src/ Element/ AddressPcaAddress.php, line 42
Namespace
Drupal\pca_address\ElementView source
class AddressPcaAddress extends Address {
use PcaAddressElementTrait;
/**
* {@inheritdoc}
*/
public function getInfo() {
$info = parent::getInfo();
$info['#process'][] = [
get_class($this),
'processPcaAddress',
];
$info['#attached']['library'][] = 'loqate/element.pca_address.address.js';
return $this
->buildElementGetInfo() + $info;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AddressPcaAddress:: |
public | function | ||
PcaAddressElementTrait:: |
private static | function | Adds a address label field. | |
PcaAddressElementTrait:: |
private static | function | Adds a lookup field. | |
PcaAddressElementTrait:: |
public | function | Get the default settings for the field widget. | |
PcaAddressElementTrait:: |
private static | function | Processes field mapping output. | |
PcaAddressElementTrait:: |
private static | function | Processes additional options and overrides. | |
PcaAddressElementTrait:: |
public static | function | Process the PCA address form element. | |
PcaAddressElementTrait:: |
private static | function | Alters the original render array in favor of PCA. |