YamlFormContact.php in YAML Form 8
File
src/Plugin/YamlFormElement/YamlFormContact.php
View source
<?php
namespace Drupal\yamlform\Plugin\YamlFormElement;
use Drupal\Core\Form\FormState;
use Drupal\yamlform\Element\YamlFormContact as YamlFormContactElement;
class YamlFormContact extends YamlFormAddress {
protected function getCompositeElements() {
return YamlFormContactElement::getCompositeElements();
}
protected function getInitializedCompositeElement(array &$element) {
$form_state = new FormState();
$form_completed = [];
return YamlFormContactElement::processYamlFormComposite($element, $form_state, $form_completed);
}
protected function formatLines(array $element, array $value) {
$lines = [];
if (!empty($value['name'])) {
$lines['name'] = $value['name'];
}
if (!empty($value['company'])) {
$lines['company'] = $value['company'];
}
$lines += parent::formatLines($element, $value);
if (!empty($value['email'])) {
$lines['email'] = $value['email'];
}
if (!empty($value['phone'])) {
$lines['phone'] = $value['phone'];
}
return $lines;
}
}