You are here

public static function WebformTelephone::getCompositeElements in Webform 8.5

Same name and namespace in other branches
  1. 6.x src/Element/WebformTelephone.php \Drupal\webform\Element\WebformTelephone::getCompositeElements()

Get a renderable array of webform elements.

Parameters

array $element: A render array for the current element.

Return value

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

Overrides WebformCompositeBase::getCompositeElements

File

src/Element/WebformTelephone.php, line 26

Class

WebformTelephone
Provides a webform element for a telephone element.

Namespace

Drupal\webform\Element

Code

public static function getCompositeElements(array $element) {
  $elements = [];
  $elements['type'] = [
    '#type' => 'select',
    '#title' => t('Type'),
    '#title_display' => 'invisible',
    '#options' => 'phone_types',
    '#empty_option' => t('- Type -'),
  ];
  $elements['phone'] = [
    '#type' => 'tel',
    '#title' => t('Phone'),
    '#title_display' => 'invisible',
    '#international' => TRUE,
  ];
  $elements['ext'] = [
    '#title' => t('Ext:'),
    '#type' => 'number',
    '#size' => 5,
    '#min' => 0,
  ];
  return $elements;
}