You are here

public static function YamlFormAddress::getCompositeElements in YAML Form 8

Same name in this branch
  1. 8 src/Element/YamlFormAddress.php \Drupal\yamlform\Element\YamlFormAddress::getCompositeElements()
  2. 8 src/Plugin/YamlFormElement/YamlFormAddress.php \Drupal\yamlform\Plugin\YamlFormElement\YamlFormAddress::getCompositeElements()

Get a renderable array of form elements.

Return value

array A renderable array of form elements, containing the base properties for the composite's form elements.

Overrides YamlFormCompositeBase::getCompositeElements

2 calls to YamlFormAddress::getCompositeElements()
YamlFormAddress::getCompositeElements in src/Plugin/YamlFormElement/YamlFormAddress.php
Get composite elements.
YamlFormContact::getCompositeElements in src/Element/YamlFormContact.php
Get a renderable array of form elements.
1 method overrides YamlFormAddress::getCompositeElements()
YamlFormContact::getCompositeElements in src/Element/YamlFormContact.php
Get a renderable array of form elements.

File

src/Element/YamlFormAddress.php, line 15

Class

YamlFormAddress
Provides a form element for an address element.

Namespace

Drupal\yamlform\Element

Code

public static function getCompositeElements() {
  $elements = [];
  $elements['address'] = [
    '#type' => 'textfield',
    '#title' => t('Address'),
  ];
  $elements['address_2'] = [
    '#type' => 'textfield',
    '#title' => t('Address 2'),
  ];
  $elements['city'] = [
    '#type' => 'textfield',
    '#title' => t('City/Town'),
  ];
  $elements['state_province'] = [
    '#type' => 'select',
    '#title' => t('State/Province'),
    '#options' => 'state_province_names',
  ];
  $elements['postal_code'] = [
    '#type' => 'textfield',
    '#title' => t('Zip/Postal Code'),
  ];
  $elements['country'] = [
    '#type' => 'select',
    '#title' => t('Country'),
    '#options' => 'country_names',
  ];
  return $elements;
}