You are here

public function LoqatePcaAddress::initializeCompositeElements in Loqate 2.x

Overrides WebformCompositeBase::initializeCompositeElements

See also

\Drupal\loqate\Plugin\Field\FieldType\LoqatePcaAddressItem::schema

File

src/Plugin/WebformElement/LoqatePcaAddress.php, line 45

Class

LoqatePcaAddress
Provides a 'PCA address' element.

Namespace

Drupal\loqate\Plugin\WebformElement

Code

public function initializeCompositeElements(array &$element) {
  $element['#webform_composite_elements'] = [
    PcaAddressElement::LINE1 => [
      '#title' => $this
        ->t('Address Line 1'),
      '#type' => 'textfield',
      '#maxlength' => 255,
    ],
    PcaAddressElement::LINE2 => [
      '#title' => $this
        ->t('Address Line 2'),
      '#type' => 'textfield',
      '#maxlength' => 255,
    ],
    PcaAddressElement::LOCALITY => [
      '#title' => $this
        ->t('City/Town'),
      '#type' => 'textfield',
      '#maxlength' => 255,
    ],
    PcaAddressElement::ADMINISTRATIVE_AREA => [
      '#title' => $this
        ->t('State/Province'),
      '#type' => 'textfield',
      '#maxlength' => 255,
    ],
    PcaAddressElement::POSTAL_CODE => [
      '#title' => $this
        ->t('ZIP/Postal Code'),
      '#type' => 'textfield',
      '#maxlength' => 255,
    ],
    PcaAddressElement::COUNTRY_CODE => [
      '#title' => $this
        ->t('Country'),
      '#type' => 'textfield',
      '#maxlength' => 2,
    ],
  ];
}