Skip to content
Snippets Groups Projects
Unverified Commit 36b2bfae authored by Alex Pott's avatar Alex Pott
Browse files

Issue #1427838 by sukr_s, smustgrave, quietone, tim.plunkett, alexpott:...

Issue #1427838 by sukr_s, smustgrave, quietone, tim.plunkett, alexpott: password_confirm children do not pick up #states or #attributes
parent 1584d2c9
Branches
No related tags found
13 merge requests!11131[10.4.x-only-DO-NOT-MERGE]: Issue ##2842525 Ajax attached to Views exposed filter form does not trigger callbacks,!3878Removed unused condition head title for views,!3818Issue #2140179: $entity->original gets stale between updates,!3154Fixes #2987987 - CSRF token validation broken on routes with optional parameters.,!3133core/modules/system/css/components/hidden.module.css,!2964Issue #2865710 : Dependencies from only one instance of a widget are used in display modes,!2812Issue #3312049: [Followup] Fix Drupal.Commenting.FunctionComment.MissingReturnType returns for NULL,!2062Issue #3246454: Add weekly granularity to views date sort,!10223132456: Fix issue where views instances are emptied before an ajax request is complete,!617Issue #3043725: Provide a Entity Handler for user cancelation,!579Issue #2230909: Simple decimals fail to pass validation,!560Move callback classRemove outside of the loop,!555Issue #3202493
Pipeline #314045 passed with warnings
Pipeline: drupal

#314067

    Pipeline: drupal

    #314059

      Pipeline: drupal

      #314049

        ......@@ -204,11 +204,11 @@ protected static function processStatesArray(array &$conditions, $search, $repla
        */
        public static function processStates(array &$elements) {
        $elements['#attached']['library'][] = 'core/drupal.states';
        // Elements of '#type' => 'item' are not actual form input elements, but we
        // still want to be able to show/hide them. Since there's no actual HTML
        // input element available, setting #attributes does not make sense, but a
        // wrapper is available, so setting #wrapper_attributes makes it work.
        $key = ($elements['#type'] == 'item') ? '#wrapper_attributes' : '#attributes';
        // Elements that are actual form input elements, use '#attributes'.
        // In cases like 'item' that are not actual form input elements or
        // those like 'password_confirm' that have child elements,
        // use #wrapper_attributes.
        $key = (($elements['#markup'] ?? FALSE) === '' && ($elements['#input'] ?? FALSE) === TRUE) ? '#wrapper_attributes' : '#attributes';
        $elements[$key]['data-drupal-states'] = Json::encode($elements['#states']);
        }
        ......
        ......@@ -732,6 +732,15 @@ public function buildForm(array $form, FormStateInterface $form_state) {
        '#title' => 'Enable textarea',
        ];
        $form['password_confirm'] = [
        '#title' => $this->t('Enter password'),
        '#type' => 'password_confirm',
        '#states' => [
        'visible' => [
        ':input[name="checkbox_trigger"]' => ['checked' => FALSE],
        ],
        ],
        ];
        $form['test_select_visible_dependence']['select_visible_1'] = [
        '#type' => 'select',
        '#title' => 'Select visible 1',
        ......
        ......@@ -187,6 +187,8 @@ protected function doCheckboxTriggerTests() {
        $this->assertFalse($radios_some_disabled_value2->hasAttribute('disabled'));
        // Check if the link is visible.
        $this->assertTrue($link->isVisible());
        // Check enter password is visible.
        $this->assertSession()->pageTextContains('Enter password');
        // Change state: check the checkbox.
        $trigger->check();
        ......@@ -228,6 +230,8 @@ protected function doCheckboxTriggerTests() {
        $this->assertFalse($radios_some_disabled_value2->hasAttribute('disabled'));
        // The link shouldn't be visible.
        $this->assertFalse($link->isVisible());
        // Check enter password is not visible.
        $this->assertSession()->pageTextNotContains('Enter password');
        // Change state: uncheck the checkbox.
        $trigger->uncheck();
        ......@@ -263,6 +267,8 @@ protected function doCheckboxTriggerTests() {
        $this->assertFalse($radios_some_disabled_value2->hasAttribute('disabled'));
        // Check if the link is turned back to visible state.
        $this->assertTrue($link->isVisible());
        // Check enter password is visible.
        $this->assertSession()->pageTextContains('Enter password');
        }
        /**
        ......
        ......@@ -120,6 +120,8 @@ public static function providerElements() {
        ':input[name="foo"]' => ['value' => 'bar'],
        ],
        ],
        '#markup' => '',
        '#input' => TRUE,
        ],
        '#wrapper_attributes',
        ],
        ......
        0% Loading or .
        You are about to add 0 people to the discussion. Proceed with caution.
        Please register or to comment