WebformContact.php in Webform 6.x
File
src/Element/WebformContact.php
View source
<?php
namespace Drupal\webform\Element;
class WebformContact extends WebformCompositeBase {
public function getInfo() {
return parent::getInfo() + [
'#theme' => 'webform_composite_contact',
];
}
public static function getCompositeElements(array $element) {
$elements = [];
$elements['name'] = [
'#type' => 'textfield',
'#title' => t('Name'),
];
$elements['company'] = [
'#type' => 'textfield',
'#title' => t('Company'),
];
$elements['email'] = [
'#type' => 'email',
'#title' => t('Email'),
];
$elements['phone'] = [
'#type' => 'tel',
'#title' => t('Phone'),
];
$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;
}
}