protected function WebformLocationBase::defineDefaultProperties in Webform 8.5
Same name and namespace in other branches
- 6.x src/Plugin/WebformElement/WebformLocationBase.php \Drupal\webform\Plugin\WebformElement\WebformLocationBase::defineDefaultProperties()
Define an element's default properties.
Return value
array An associative array contain an the element's default properties.
Overrides WebformCompositeBase::defineDefaultProperties
2 calls to WebformLocationBase::defineDefaultProperties()
- WebformLocationGeocomplete::defineDefaultProperties in modules/
webform_location_geocomplete/ src/ Plugin/ WebformElement/ WebformLocationGeocomplete.php - Define an element's default properties.
- WebformLocationPlaces::defineDefaultProperties in src/
Plugin/ WebformElement/ WebformLocationPlaces.php - Define an element's default properties.
2 methods override WebformLocationBase::defineDefaultProperties()
- WebformLocationGeocomplete::defineDefaultProperties in modules/
webform_location_geocomplete/ src/ Plugin/ WebformElement/ WebformLocationGeocomplete.php - Define an element's default properties.
- WebformLocationPlaces::defineDefaultProperties in src/
Plugin/ WebformElement/ WebformLocationPlaces.php - Define an element's default properties.
File
- src/
Plugin/ WebformElement/ WebformLocationBase.php, line 15
Class
- WebformLocationBase
- Provides a base 'location' element.
Namespace
Drupal\webform\Plugin\WebformElementCode
protected function defineDefaultProperties() {
$properties = [
'title' => '',
'default_value' => [],
'multiple' => FALSE,
// Description/Help.
'help' => '',
'help_title' => '',
'description' => '',
'more' => '',
'more_title' => '',
// Form display.
'title_display' => '',
'description_display' => '',
'disabled' => FALSE,
// Form validation.
'required' => FALSE,
'required_error' => '',
// Attributes.
'wrapper_attributes' => [],
'label_attributes' => [],
// Submission display.
'format' => $this
->getItemDefaultFormat(),
'format_html' => '',
'format_text' => '',
'format_items' => $this
->getItemsDefaultFormat(),
'format_items_html' => '',
'format_items_text' => '',
] + $this
->defineDefaultBaseProperties();
$composite_elements = $this
->getCompositeElements();
foreach ($composite_elements as $composite_key => $composite_element) {
$properties[$composite_key . '__title'] = (string) $composite_element['#title'];
// The value is always visible and supports a custom placeholder.
if ($composite_key === 'value') {
$properties[$composite_key . '__placeholder'] = '';
}
else {
$properties[$composite_key . '__access'] = FALSE;
}
}
return $properties;
}