You are here

public function Address::initializeCompositeElements in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/Plugin/WebformElement/Address.php \Drupal\webform\Plugin\WebformElement\Address::initializeCompositeElements()

Overrides WebformCompositeBase::initializeCompositeElements

See also

\Drupal\address\Plugin\Field\FieldType\AddressItem::schema

File

src/Plugin/WebformElement/Address.php, line 162

Class

Address
Provides a 'address' element.

Namespace

Drupal\webform\Plugin\WebformElement

Code

public function initializeCompositeElements(array &$element) {
  $element['#webform_composite_elements'] = [
    'given_name' => [
      '#title' => $this
        ->t('Given name'),
      '#type' => 'textfield',
      '#maxlength' => 255,
    ],
    'family_name' => [
      '#title' => $this
        ->t('Family name'),
      '#type' => 'textfield',
      '#maxlength' => 255,
    ],
    'additional_name' => [
      '#title' => $this
        ->t('Additional name'),
      '#type' => 'textfield',
      '#maxlength' => 255,
    ],
    'organization' => [
      '#title' => $this
        ->t('Organization'),
      '#type' => 'textfield',
      '#maxlength' => 255,
    ],
    'address_line1' => [
      '#title' => $this
        ->t('Address line 1'),
      '#type' => 'textfield',
      '#maxlength' => 255,
    ],
    'address_line2' => [
      '#title' => $this
        ->t('Address line 2'),
      '#type' => 'textfield',
      '#maxlength' => 255,
    ],
    'postal_code' => [
      '#title' => $this
        ->t('Postal code'),
      '#type' => 'textfield',
      '#maxlength' => 255,
    ],
    'locality' => [
      '#title' => $this
        ->t('Locality'),
      '#type' => 'textfield',
      '#maxlength' => 255,
    ],
    'dependent_locality' => [
      '#title' => $this
        ->t('Dependent_locality'),
      '#type' => 'textfield',
      '#maxlength' => 255,
    ],
    'administrative_area' => [
      '#title' => $this
        ->t('Administrative area'),
      '#type' => 'textfield',
      '#maxlength' => 255,
    ],
    'country_code' => [
      '#title' => $this
        ->t('Country code'),
      '#type' => 'textfield',
      '#maxlength' => 2,
    ],
    'langcode' => [
      '#title' => $this
        ->t('Language code'),
      '#type' => 'textfield',
      '#maxlength' => 32,
    ],
    'sorting_code' => [
      '#title' => $this
        ->t('Sorting code'),
      '#type' => 'textfield',
      '#maxlength' => 255,
    ],
  ];
}