This repository has been archived on 2025-01-19. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
drupalcampbristol/web/modules/contrib/webform/src/Element/WebformContact.php
2018-11-23 12:29:20 +00:00

69 lines
1.5 KiB
PHP

<?php
namespace Drupal\webform\Element;
/**
* Provides a webform element for a contact element.
*
* @FormElement("webform_contact")
*/
class WebformContact extends WebformCompositeBase {
/**
* {@inheritdoc}
*/
public function getInfo() {
return parent::getInfo() + ['#theme' => 'webform_composite_contact'];
}
/**
* {@inheritdoc}
*/
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;
}
}