You are here

protected function YamlFormContact::formatLines in YAML Form 8

Format composite element value into lines of text.

Parameters

array $element: A composite element.

array $value: Composite element values.

Return value

array Composite element values converted into lines of text.

Overrides YamlFormAddress::formatLines

File

src/Plugin/YamlFormElement/YamlFormContact.php, line 41

Class

YamlFormContact
Provides a 'contact' element.

Namespace

Drupal\yamlform\Plugin\YamlFormElement

Code

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;
}