protected function ResponsiveTrait::createBreakpointFormField in Bootstrap Styles 1.0.x
Build the breakpoints configuration form.
Parameters
array $form: An associative array containing the structure of the form.
array $fields: The array of fields, each field has its parents and keyed by field name.
File
- src/
ResponsiveTrait.php, line 123
Class
- ResponsiveTrait
- A Trait for responsive methods.
Namespace
Drupal\bootstrap_stylesCode
protected function createBreakpointFormField(array &$form, string $breakpoint_key, string $field_name, array $original_parents, array $new_parents = []) {
// Loop through the breakpoints.
// foreach ($this->getBreakpoints() as $breakpoint_key => $breakpoint_value) {
// Get the original field.
$field = NestedArray::getValue($form, array_merge($original_parents, [
$field_name,
]));
// Change field attributes.
$field['#title'] .= ' - ' . $this
->getBreakpointTitle($breakpoint_key);
$field['#default_value'] = $this
->config()
->get($field_name . '_' . $breakpoint_key);
$target_parents = $original_parents;
if ($new_parents) {
$target_parents = $new_parents;
}
NestedArray::setValue($form, array_merge($target_parents, [
$field_name . '_' . $breakpoint_key,
]), $field);
// }
}