protected function GeofieldMapFieldTrait::setMapLazyLoad in Geofield Map 8.2
Set Map Lazy Load Element.
Parameters
array $settings: The Form Settings.
array $elements: The Form element to alter.
1 call to GeofieldMapFieldTrait::setMapLazyLoad()
- GeofieldMapFieldTrait::generateGmapSettingsForm in src/
GeofieldMapFieldTrait.php - Generate the Google Map Settings Form.
File
- src/
GeofieldMapFieldTrait.php, line 1537
Class
- GeofieldMapFieldTrait
- Class GeofieldMapFieldTrait.
Namespace
Drupal\geofield_mapCode
protected function setMapLazyLoad(array $settings, array &$elements) {
$elements['map_lazy_load'] = [
'#type' => 'fieldset',
'#title' => $this
->t('Lazy Loading'),
];
$elements['map_lazy_load']['lazy_load'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Lazy load map'),
'#description' => $this
->t("If checked, the map will be loaded when it enters the user's viewport. This can be useful to reduce unnecessary load time or API calls."),
'#default_value' => !empty($settings['map_lazy_load']['lazy_load']) ? $settings['map_lazy_load']['lazy_load'] : 0,
'#return_value' => 1,
];
}