summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwebchick2015-09-30 21:04:55 (GMT)
committerwebchick2015-09-30 21:04:55 (GMT)
commit09b1d9bcfc66ed69e25d00b2317e9ac8940d13ad (patch)
treeb4d3c3170a9fb471fac35df25c62a3bb73c22544
parent105518a28e4eb9cc3d1f27b1cde9c56162f79460 (diff)
Issue #2547917 by Jelle_S, attiks: Add states API / ajax update for the breakpoint group form
-rw-r--r--core/modules/responsive_image/src/ResponsiveImageStyleForm.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/core/modules/responsive_image/src/ResponsiveImageStyleForm.php b/core/modules/responsive_image/src/ResponsiveImageStyleForm.php
index 9e10fe9..6fc982b 100644
--- a/core/modules/responsive_image/src/ResponsiveImageStyleForm.php
+++ b/core/modules/responsive_image/src/ResponsiveImageStyleForm.php
@@ -100,6 +100,17 @@ class ResponsiveImageStyleForm extends EntityForm {
'#options' => $this->breakpointManager->getGroups(),
'#required' => TRUE,
'#description' => $description,
+ '#ajax' => array(
+ 'callback' => '::breakpointMappingFormAjax',
+ 'wrapper' => 'responsive-image-style-breakpoints-wrapper',
+ ),
+ );
+
+ $form['keyed_styles'] = array(
+ '#type' => 'container',
+ '#attributes' => array(
+ 'id' => 'responsive-image-style-breakpoints-wrapper',
+ ),
);
// By default, breakpoints are ordered from smallest weight to largest:
@@ -192,6 +203,13 @@ class ResponsiveImageStyleForm extends EntityForm {
}
/**
+ * Get the form for mapping breakpoints to image styles.
+ */
+ public function breakpointMappingFormAjax($form, FormStateInterface $form_state) {
+ return $form['keyed_styles'];
+ }
+
+ /**
* {@inheritdoc}
*/
public function validateForm(array &$form, FormStateInterface $form_state) {