protected function ResponsiveTrait::buildResponsivePreviewer in Bootstrap Styles 1.0.x
Build the responsive previewer form elements.
Parameters
array $form: An associative array containing the structure of the form.
File
- src/
ResponsiveTrait.php, line 36
Class
- ResponsiveTrait
- A Trait for responsive methods.
Namespace
Drupal\bootstrap_stylesCode
protected function buildResponsivePreviewer(array &$form) {
$icon_path = drupal_get_path('module', 'bootstrap_styles') . '/images/';
$form['bs_responsive'] = [
'#type' => 'radios',
'#options' => [
'all' => $this
->getSvgIconMarkup($icon_path . 'responsive/device-all.svg'),
],
'#title' => $this
->t('Responsive'),
'#title_display' => 'invisible',
'#default_value' => 'all',
'#validated' => TRUE,
'#attributes' => [
'class' => [
'bs_col--full',
'bs_responsive',
'bs_responsive_bar',
],
],
'#disable_live_preview' => TRUE,
];
// Loop through the breakpoints.
foreach ($this
->getBreakpoints() as $breakpoint_key => $breakpoint_value) {
$form['bs_responsive']['#options'][$breakpoint_key] = $this
->getSvgIconMarkup($icon_path . 'responsive/device-' . $breakpoint_key . '.svg');
}
// Attach admin form style.
$form['#attached']['library'][] = 'bootstrap_styles/bs_responsive';
}