public static function WebformLocationPlaces::processWebformComposite in Webform 6.x
Same name and namespace in other branches
- 8.5 src/Element/WebformLocationPlaces.php \Drupal\webform\Element\WebformLocationPlaces::processWebformComposite()
Processes a composite webform element.
Overrides WebformLocationBase::processWebformComposite
File
- src/
Element/ WebformLocationPlaces.php, line 50
Class
- WebformLocationPlaces
- Provides a webform element for a location places element.
Namespace
Drupal\webform\ElementCode
public static function processWebformComposite(&$element, FormStateInterface $form_state, &$complete_form) {
$element = parent::processWebformComposite($element, $form_state, $complete_form);
// Add Algolia application id and API key.
$app_id = !empty($element['#app_id']) ? $element['#app_id'] : \Drupal::config('webform.settings')
->get('element.default_algolia_places_app_id');
$api_key = !empty($element['#api_key']) ? $element['#api_key'] : \Drupal::config('webform.settings')
->get('element.default_algolia_places_api_key');
$element['#attached']['drupalSettings']['webform']['location']['places'] = [
'app_id' => $app_id,
'api_key' => $api_key,
];
// Attach library.
$element['#attached']['library'][] = 'webform/webform.element.location.places';
return $element;
}