public function BootstrapLayout::addAjaxLivePreviewToElements in Bootstrap Layout Builder 2.x
1 call to BootstrapLayout::addAjaxLivePreviewToElements()
- BootstrapLayout::buildConfigurationForm in src/
Plugin/ Layout/ BootstrapLayout.php - Form constructor.
File
- src/
Plugin/ Layout/ BootstrapLayout.php, line 559
Class
- BootstrapLayout
- A layout from our bootstrap layout builder.
Namespace
Drupal\bootstrap_layout_builder\Plugin\LayoutCode
public function addAjaxLivePreviewToElements(array &$element) {
$types = [
'radios',
'radio',
'checkbox',
'textfield',
'textarea',
'range',
];
if (!isset($element['#type'])) {
return;
}
if (in_array($element['#type'], $types) && !isset($element['#ajax']) && !isset($element['#disable_live_preview'])) {
$element['#ajax']['callback'] = [
__CLASS__,
'livePreviewCallback',
];
$element['#ajax']['event'] = 'change';
$element['#ajax']['progress'] = [
'type' => 'none',
];
}
if (Element::children($element)) {
foreach (Element::children($element) as $key) {
$this
->addAjaxLivePreviewToElements($element[$key]);
}
}
}