You are here

public function YamlFormLocation::getDefaultProperties in YAML Form 8

Only a few elements don't inherit these default properties.

Overrides YamlFormCompositeBase::getDefaultProperties

See also

\Drupal\yamlform\Plugin\YamlFormElement\Textarea

\Drupal\yamlform\Plugin\YamlFormElement\YamlFormLikert

\Drupal\yamlform\Plugin\YamlFormElement\YamlFormCompositeBase

\Drupal\yamlform\Plugin\YamlFormElement\ContainerBase

File

src/Plugin/YamlFormElement/YamlFormLocation.php, line 45

Class

YamlFormLocation
Provides an 'location' element.

Namespace

Drupal\yamlform\Plugin\YamlFormElement

Code

public function getDefaultProperties() {
  $properties = [
    'title' => '',
    // General settings.
    'description' => '',
    'default_value' => [],
    // For display.
    'title_display' => '',
    'description_display' => '',
    // Form validation.
    'required' => FALSE,
    // Location settings.
    'geolocation' => FALSE,
    'hidden' => FALSE,
    'api_key' => '',
  ] + $this
    ->getDefaultBaseProperties();
  $composite_elements = $this
    ->getCompositeElements();
  foreach ($composite_elements as $composite_key => $composite_element) {
    $properties[$composite_key . '__title'] = (string) $composite_element['#title'];
    if ($composite_key != 'value') {
      $properties[$composite_key . '__access'] = FALSE;
    }
  }
  return $properties;
}