protected function ResponsiveTrait::buildBreakpointsStyleFormElements in Bootstrap Styles 1.0.x
TODO: RENAME Build the breakpoints style form elements.
Parameters
array $form: An associative array containing the structure of the form.
array $fields: The array of fields, the style options key and keyed by field name.
array $storage: An associative array containing the form storage.
string $group_id: The plugin group id.
File
- src/
ResponsiveTrait.php, line 311
Class
- ResponsiveTrait
- A Trait for responsive methods.
Namespace
Drupal\bootstrap_stylesCode
protected function buildBreakpointsStyleFormElements(array &$form, array $fields, array $storage, string $group_id) {
// Loop through the fields.
foreach ($fields as $field_name => $style_options_key) {
// Loop through the breakpoints.
foreach ($this
->getBreakpointsKeys() as $breakpoint) {
$form[$field_name . '_' . $breakpoint] = $form[$field_name];
$form[$field_name . '_' . $breakpoint]['#options'] = $this
->getStyleOptions($style_options_key . '_' . $breakpoint);
$form[$field_name . '_' . $breakpoint]['#default_value'] = $storage[$field_name . '_' . $breakpoint]['class'] ?? NULL;
$form[$field_name . '_' . $breakpoint]['#states']['visible'][':input.bs_responsive_' . $group_id]['value'] = $breakpoint;
// Hide the generic one.
$form[$field_name]['#states']['visible'][':input.bs_responsive_' . $group_id]['value'] = 'all';
}
}
}