Problem

Conditional logic using #states API only provides client side validation. The Webform module needs to support server side validation.

Solution

Provide server side validation for #states API.

Goals

Reuse #states API selectors and nomenclature to create a custom Webform specific server side conditional logic validator and manager

Tasks

  • Setup basic required single page validation test form
  • Add WebformStatesValidator service
  • Write test for getting submission value using selector
  • Add required validation for all element variants

Notes

  • Must support cross page conditional.
  • Cross page conditional logic must track which elements are visible for the current page.
  • State validation must be triggered last.
  • Conditions MUST be validated using the submission data and not to $form_state->getValue(). This will make it possible to support cross-page conditional logic and conditional handlers.
  • Parsing :input selector
  • First part of the name array is always to element key

API changes

  • WebformElementBase::getElementSelectorInputValue($element, $webform_submission, $selector)
  • WebformStatesValidator service

Test forms

  • All conditions will require a single element
  • All conditions will disable a single element
  • All conditions will hide a single element

Element variants

  • Basic text value
  • Boolean
  • Composite
  • Other
  • Entity reference
  • Options
  • Likert
  • Computed

References

  • \Drupal\Core\Condition\ConditionAccessResolverTrait::resolveConditions
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jrockowitz created an issue. See original summary.

jrockowitz’s picture

Title: Server side Conditional Login using #states API » Server side Conditional Logic using #states API

  • 04066cf committed on 2900719-server-states-api
    Issue #2900719: Server side Conditional Logic using #states API
    

  • 5927035 committed on 2900719-server-states-api
    Issue #2900719: Server side Conditional Logic using #states API
    

  • 1e562a4 committed on 2900719-server-states-api
    Issue #2900719: Server side Conditional Logic using #states API
    

  • f1e356a committed on 2900719-server-states-api
    Issue #2900719: Server side Conditional Logic using #states API
    
jrockowitz’s picture

Status: Active » Needs review
FileSize
30.28 KB

  • eaf8cf4 committed on 2900719-server-states-api
    Issue #2900719: Server side Conditional Logic using #states API....

  • b50b95a committed on 2900719-server-states-api
    Issue #2900719: Server side Conditional Logic using #states API....

  • ccb9d37 committed on 2900719-server-states-api
    Issue #2900719: Server side Conditional Logic using #states API....

  • 51e2c37 committed on 2900719-server-states-api
    Issue #2900719: Server side Conditional Logic using #states API. More...

  • b1d2731 committed on 2900719-server-states-api
    Issue #2900719: Server side Conditional Logic using #states API. Cross...

  • 05f48a1 committed on 2900719-server-states-api
    Issue #2900719: Server side Conditional Logic using #states API. Cross...

  • ce207d0 committed on 2900719-server-states-api
    Issue #2900719: Server side Conditional Logic using #states API. Cleanup...
jrockowitz’s picture

  • cc5c949 committed on 2900719-server-states-api
    Issue #2900719: Server side Conditional Logic using #states API. Cleanup...

  • a3d0cf6 committed on 2900719-server-states-api
    Issue #2900719: Server side Conditional Logic using #states API. Cleanup...

  • 94f9f46 committed on 2900719-server-states-api
    Issue #2900719: Server side Conditional Logic using #states API. Write...

  • 95ae4b0 committed on 2900719-server-states-api
    Issue #2900719: Server side Conditional Logic using #states API. Write...
jrockowitz’s picture

Status: Needs review » Needs work

The last submitted patch, 20: server_side_conditional-2900719-20.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

  • 8439c2b committed on 2900719-server-states-api
    Issue #2900719: Server side Conditional Logic using #states API. Write...
jrockowitz’s picture

Status: Needs work » Needs review
FileSize
75.94 KB

  • jrockowitz authored 5a4a5dc on 8.x-5.x
    Issue #2900719 by jrockowitz, mmaciusowicz-rr: Server side Conditional...

jrockowitz’s picture

Status: Needs review » Fixed
katannshaw’s picture

@jrockowitz: I attempted to apply your patch from #23 and received an error stating that the patch cannot be applied. Here's my setup

Changed webform version from 8.x-5.0-beta to 8.x-5.x-dev
Added your patch to composer.json like this:
"patches": {
"drupal/webform": {
"Server side Conditional Logic using #states API": "https://www.drupal.org/files/issues/server_side_conditional-2900719-23.p..."
}
}

Running `composer install --verbose` and `composer update drupal/webform --verbose` returned this result:

composer install --verbose
Gathering patches for root package.
Removing package drupal/webform so that it can be re-installed and re-patched.
Deleting web/modules/contrib/webform - deleted
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Analyzed 354 packages to resolve dependencies
Analyzed 1062 rules to resolve dependencies
Package operations: 1 installs, 0 updates, 0 removals
Found 1 patches for drupal/webform

  - Installing drupal/webform (dev-5.x 5a4a5dc): Cloning 5a4a5dcb2dc90bd703115fbb07854d8120413b19 from cache
  - Applying patches for drupal/webform
    https://www.drupal.org/files/issues/server_side_conditional-2900719-23.patch (Server side Conditional Logic using #states API)
cd 'web/modules/contrib/webform' && git --git-dir=. apply --check '-p1' '/var/folders/hz/krf1btss1ngd_m5nm3vp6xwm0000gn/T/598dede297d66.patch'
error: patch failed: js/webform.element.details.save.js:22
error: js/webform.element.details.save.js: patch does not apply
error: patch failed: src/Element/WebformElementStates.php:274
error: src/Element/WebformElementStates.php: patch does not apply

error: patch failed: src/Element/WebformOtherBase.php:169
error: src/Element/WebformOtherBase.php: patch does not apply
error: patch failed: src/Plugin/WebformElement/Checkboxes.php:3
error: src/Plugin/WebformElement/Checkboxes.php: patch does not apply
error: patch failed: src/Plugin/WebformElement/DateList.php:2
error: src/Plugin/WebformElement/DateList.php: patch does not apply
error: patch failed: src/Plugin/WebformElement/DateTime.php:2
error: src/Plugin/WebformElement/DateTime.php: patch does not apply
error: patch failed: src/Plugin/WebformElement/OptionsBase.php:10
error: src/Plugin/WebformElement/OptionsBase.php: patch does not apply
error: patch failed: src/Plugin/WebformElement/TextFormat.php:7
error: src/Plugin/WebformElement/TextFormat.php: patch does not apply
error: patch failed: src/Plugin/WebformElement/WebformButtonsOther.php:12
error: src/Plugin/WebformElement/WebformButtonsOther.php: patch does not apply
error: patch failed: src/Plugin/WebformElement/WebformCheckboxesOther.php:16
error: src/Plugin/WebformElement/WebformCheckboxesOther.php: patch does not apply
error: patch failed: src/Plugin/WebformElement/WebformRadiosOther.php:12
error: src/Plugin/WebformElement/WebformRadiosOther.php: patch does not apply
error: patch failed: src/Plugin/WebformElement/WebformSelectOther.php:12
error: src/Plugin/WebformElement/WebformSelectOther.php: patch does not apply

error: patch failed: src/Plugin/WebformElementBase.php:25
error: src/Plugin/WebformElementBase.php: patch does not apply
error: patch failed: src/Plugin/WebformElementInterface.php:445
error: src/Plugin/WebformElementInterface.php: patch does not apply
error: patch failed: src/Tests/Element/WebformElementComputedTest.php:18
error: src/Tests/Element/WebformElementComputedTest.php: patch does not apply
error: patch failed: src/Tests/Element/WebformElementHtmlEditorTest.php:17
error: src/Tests/Element/WebformElementHtmlEditorTest.php: patch does not apply
error: patch failed: src/Tests/Element/WebformElementStatesTest.php:76
error: src/Tests/Element/WebformElementStatesTest.php: patch does not apply
error: patch failed: src/Tests/WebformEntityReferenceItemNormalizerTest.php:16
error: src/Tests/WebformEntityReferenceItemNormalizerTest.php: patch does not apply
error: src/Tests/WebformSubmissionStatesValidatorTest.php: already exists in working directory
error: patch failed: src/WebformRequestInterface.php:4
error: src/WebformRequestInterface.php: patch does not apply
error: patch failed: src/WebformSubmissionForm.php:115
error: src/WebformSubmissionForm.php: patch does not apply
error: src/WebformSubmissionStatesValidator.php: already exists in working directory
error: src/WebformSubmissionStatesValidatorInterface.php: already exists in working directory
error: tests/modules/webform_test/config/install/webform.webform.test_form_states_server_required.yml: already exists in working directory
error: tests/modules/webform_test/config/install/webform.webform.test_form_states_server_wizard.yml: already exists in working directory
error: patch failed: webform.services.yml:69
error: webform.services.yml: patch does not apply

cd 'web/modules/contrib/webform' && git --git-dir=. apply --check '-p0' '/var/folders/hz/krf1btss1ngd_m5nm3vp6xwm0000gn/T/598dede297d66.patch'
error: a/config/schema/webform.schema.yml: No such file or directory
error: a/js/webform.element.details.save.js: No such file or directory
error: a/src/Element/WebformElementStates.php: No such file or directory
error: a/src/Element/WebformOtherBase.php: No such file or directory
error: a/src/Plugin/WebformElement/Checkboxes.php: No such file or directory
error: a/src/Plugin/WebformElement/DateList.php: No such file or directory
error: a/src/Plugin/WebformElement/DateTime.php: No such file or directory
error: a/src/Plugin/WebformElement/OptionsBase.php: No such file or directory
error: a/src/Plugin/WebformElement/TextFormat.php: No such file or directory
error: a/src/Plugin/WebformElement/WebformButtonsOther.php: No such file or directory
error: a/src/Plugin/WebformElement/WebformCheckboxesOther.php: No such file or directory
error: a/src/Plugin/WebformElement/WebformRadiosOther.php: No such file or directory
error: a/src/Plugin/WebformElement/WebformSelectOther.php: No such file or directory
error: a/src/Plugin/WebformElementBase.php: No such file or directory
error: a/src/Plugin/WebformElementInterface.php: No such file or directory
error: a/src/Tests/Element/WebformElementComputedTest.php: No such file or directory
error: a/src/Tests/Element/WebformElementHtmlEditorTest.php: No such file or directory
error: a/src/Tests/Element/WebformElementStatesTest.php: No such file or directory
error: a/src/Tests/WebformEntityReferenceItemNormalizerTest.php: No such file or directory
error: a/src/WebformRequestInterface.php: No such file or directory
error: a/src/WebformSubmissionForm.php: No such file or directory

error: a/webform.services.yml: No such file or directory

cd 'web/modules/contrib/webform' && git --git-dir=. apply --check '-p2' '/var/folders/hz/krf1btss1ngd_m5nm3vp6xwm0000gn/T/598dede297d66.patch'
fatal: git diff header lacks filename information when removing 2 leading pathname components (line 2189)

patch '-p1' --no-backup-if-mismatch -d 'web/modules/contrib/webform' < '/var/folders/hz/krf1btss1ngd_m5nm3vp6xwm0000gn/T/598dede297d66.patch'
patching file config/schema/webform.schema.yml

patching file js/webform.element.details.save.js

Reversed (or previously applied) patch detected!  Assume -R? [n]
Apply anyway? [n]
Skipping patch.

1 out of 1 hunk ignored -- saving rejects to file js/webform.element.details.save.js.rej


patching file src/Element/WebformElementStates.php

Reversed (or previously applied) patch detected!  Assume -R? [n]
Apply anyway? [n]
Skipping patch.

1 out of 1 hunk ignored -- saving rejects to file src/Element/WebformElementStates.php.rej


patching file src/Element/WebformOtherBase.php
Reversed (or previously applied) patch detected!  Assume -R? [n]
Apply anyway? [n]
Skipping patch.

2 out of 2 hunks ignored -- saving rejects to file src/Element/WebformOtherBase.php.rej

patching file src/Plugin/WebformElement/Checkboxes.php
Reversed (or previously applied) patch detected!  Assume -R? [n]
Apply anyway? [n]
Skipping patch.
2 out of 2 hunks ignored -- saving rejects to file src/Plugin/WebformElement/Checkboxes.php.rej


patching file src/Plugin/WebformElement/DateList.php
Reversed (or previously applied) patch detected!  Assume -R? [n]
Apply anyway? [n]
Skipping patch.

2 out of 2 hunks ignored -- saving rejects to file src/Plugin/WebformElement/DateList.php.rej


patching file src/Plugin/WebformElement/DateTime.php
Reversed (or previously applied) patch detected!  Assume -R? [n]
Apply anyway? [n]
Skipping patch.

2 out of 2 hunks ignored -- saving rejects to file src/Plugin/WebformElement/DateTime.php.rej


patching file src/Plugin/WebformElement/OptionsBase.php

Reversed (or previously applied) patch detected!  Assume -R? [n]
Apply anyway? [n]
Skipping patch.

4 out of 4 hunks ignored -- saving rejects to file src/Plugin/WebformElement/OptionsBase.php.rej

patching file src/Plugin/WebformElement/TextFormat.php
Reversed (or previously applied) patch detected!  Assume -R? [n]
Apply anyway? [n]
Skipping patch.

1 out of 1 hunk ignored -- saving rejects to file src/Plugin/WebformElement/TextFormat.php.rej

patching file src/Plugin/WebformElement/WebformButtonsOther.php
Reversed (or previously applied) patch detected!  Assume -R? [n]
Apply anyway? [n]
Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file src/Plugin/WebformElement/WebformButtonsOther.php.rej


patching file src/Plugin/WebformElement/WebformCheckboxesOther.php
Reversed (or previously applied) patch detected!  Assume -R? [n]
Apply anyway? [n]
Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file src/Plugin/WebformElement/WebformCheckboxesOther.php.rej

patching file src/Plugin/WebformElement/WebformRadiosOther.php
Reversed (or previously applied) patch detected!  Assume -R? [n]
Apply anyway? [n]
Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file src/Plugin/WebformElement/WebformRadiosOther.php.rej


patching file src/Plugin/WebformElement/WebformSelectOther.php
Reversed (or previously applied) patch detected!  Assume -R? [n]
Apply anyway? [n]
Skipping patch.

1 out of 1 hunk ignored -- saving rejects to file src/Plugin/WebformElement/WebformSelectOther.php.rej


patching file src/Plugin/WebformElementBase.php

Reversed (or previously applied) patch detected!  Assume -R? [n]
Apply anyway? [n]
Skipping patch.

3 out of 3 hunks ignored -- saving rejects to file src/Plugin/WebformElementBase.php.rej

patching file src/Plugin/WebformElementInterface.php
Reversed (or previously applied) patch detected!  Assume -R? [n]
Apply anyway? [n]
Skipping patch.

2 out of 2 hunks ignored -- saving rejects to file src/Plugin/WebformElementInterface.php.rej


patching file src/Tests/Element/WebformElementComputedTest.php

Reversed (or previously applied) patch detected!  Assume -R? [n]
Apply anyway? [n]
Skipping patch.

1 out of 1 hunk ignored -- saving rejects to file src/Tests/Element/WebformElementComputedTest.php.rej


patching file src/Tests/Element/WebformElementHtmlEditorTest.php
Reversed (or previously applied) patch detected!  Assume -R? [n]
Apply anyway? [n]
Skipping patch.

1 out of 1 hunk ignored -- saving rejects to file src/Tests/Element/WebformElementHtmlEditorTest.php.rej


patching file src/Tests/Element/WebformElementStatesTest.php
Reversed (or previously applied) patch detected!  Assume -R? [n]
Apply anyway? [n]
Skipping patch.

1 out of 1 hunk ignored -- saving rejects to file src/Tests/Element/WebformElementStatesTest.php.rej


patching file src/Tests/WebformEntityReferenceItemNormalizerTest.php
Reversed (or previously applied) patch detected!  Assume -R? [n]
Apply anyway? [n]
Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file src/Tests/WebformEntityReferenceItemNormalizerTest.php.rej

The next patch would create the file src/Tests/WebformSubmissionStatesValidatorTest.php,
which already exists!  Assume -R? [n]
Apply anyway? [n]
Skipping patch.

1 out of 1 hunk ignored -- saving rejects to file src/Tests/WebformSubmissionStatesValidatorTest.php.rej

patching file src/WebformRequestInterface.php
Reversed (or previously applied) patch detected!  Assume -R? [n]
Apply anyway? [n]
Skipping patch.

1 out of 1 hunk ignored -- saving rejects to file src/WebformRequestInterface.php.rej

patching file src/WebformSubmissionForm.php
Reversed (or previously applied) patch detected!  Assume -R? [n]
Apply anyway? [n]
Skipping patch.
7 out of 7 hunks ignored -- saving rejects to file src/WebformSubmissionForm.php.rej
The next patch would create the file src/WebformSubmissionStatesValidator.php,
which already exists!  Assume -R? [n]
Apply anyway? [n]
Skipping patch.

1 out of 1 hunk ignored -- saving rejects to file src/WebformSubmissionStatesValidator.php.rej
The next patch would create the file src/WebformSubmissionStatesValidatorInterface.php,
which already exists!  Assume -R? [n]
Apply anyway? [n]

Skipping patch.

1 out of 1 hunk ignored -- saving rejects to file src/WebformSubmissionStatesValidatorInterface.php.rej

The next patch would create the file tests/modules/webform_test/config/install/webform.webform.test_form_states_server_required.yml,
which already exists!  Assume -R? [n]
Apply anyway? [n]
Skipping patch.

1 out of 1 hunk ignored -- saving rejects to file tests/modules/webform_test/config/install/webform.webform.test_form_states_server_required.yml.rej
The next patch would create the file tests/modules/webform_test/config/install/webform.webform.test_form_states_server_wizard.yml,
which already exists!  Assume -R? [n]
Apply anyway? [n]
Skipping patch.

1 out of 1 hunk ignored -- saving rejects to file tests/modules/webform_test/config/install/webform.webform.test_form_states_server_wizard.yml.rej
patching file webform.services.yml
Reversed (or previously applied) patch detected!  Assume -R? [n]
Apply anyway? [n]
Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file webform.services.yml.rej

patch '-p0' --no-backup-if-mismatch -d 'web/modules/contrib/webform' < '/var/folders/hz/krf1btss1ngd_m5nm3vp6xwm0000gn/T/598dede297d66.patch'
can't find file to patch at input line 5
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/config/schema/webform.schema.yml b/config/schema/webform.schema.yml
|index a914588d..d81a6b28 100644
|--- a/config/schema/webform.schema.yml
|+++ b/config/schema/webform.schema.yml
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.

2 out of 2 hunks ignored
can't find file to patch at input line 35
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/js/webform.element.details.save.js b/js/webform.element.details.save.js
|index 9c8a066d..72191068 100644
|--- a/js/webform.element.details.save.js
|+++ b/js/webform.element.details.save.js
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.
1 out of 1 hunk ignored
can't find file to patch at input line 52
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/src/Element/WebformElementStates.php b/src/Element/WebformElementStates.php
|index 651cc38d..0f980f34 100644
|--- a/src/Element/WebformElementStates.php
|+++ b/src/Element/WebformElementStates.php
--------------------------

File to patch:
Skip this patch? [y]
Skipping patch.

1 out of 1 hunk ignored

can't find file to patch at input line 65
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/src/Element/WebformOtherBase.php b/src/Element/WebformOtherBase.php
|index 2c15d4a4..419bd243 100644
|--- a/src/Element/WebformOtherBase.php
|+++ b/src/Element/WebformOtherBase.php
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.

2 out of 2 hunks ignored
can't find file to patch at input line 98
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/src/Plugin/WebformElement/Checkboxes.php b/src/Plugin/WebformElement/Checkboxes.php
|index 1772ac8b..40055cf0 100644
|--- a/src/Plugin/WebformElement/Checkboxes.php
|+++ b/src/Plugin/WebformElement/Checkboxes.php
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.

2 out of 2 hunks ignored
can't find file to patch at input line 132
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/src/Plugin/WebformElement/DateList.php b/src/Plugin/WebformElement/DateList.php
|index f1ceae10..d4b1db7a 100644
|--- a/src/Plugin/WebformElement/DateList.php
|+++ b/src/Plugin/WebformElement/DateList.php
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.

2 out of 2 hunks ignored
can't find file to patch at input line 202
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/src/Plugin/WebformElement/DateTime.php b/src/Plugin/WebformElement/DateTime.php
|index 62820201..a6bf0c69 100644
|--- a/src/Plugin/WebformElement/DateTime.php
|+++ b/src/Plugin/WebformElement/DateTime.php
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.

2 out of 2 hunks ignored
can't find file to patch at input line 243
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/src/Plugin/WebformElement/OptionsBase.php b/src/Plugin/WebformElement/OptionsBase.php
|index 649be0e2..0961ce45 100644
|--- a/src/Plugin/WebformElement/OptionsBase.php
|+++ b/src/Plugin/WebformElement/OptionsBase.php
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.

4 out of 4 hunks ignored
can't find file to patch at input line 411
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------

|diff --git a/src/Plugin/WebformElement/TextFormat.php b/src/Plugin/WebformElement/TextFormat.php
|index 56f8ee09..484e6531 100644
|--- a/src/Plugin/WebformElement/TextFormat.php
|+++ b/src/Plugin/WebformElement/TextFormat.php
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.

1 out of 1 hunk ignored
can't find file to patch at input line 423
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/src/Plugin/WebformElement/WebformButtonsOther.php b/src/Plugin/WebformElement/WebformButtonsOther.php
|index 26d40c06..8ae9842e 100644
|--- a/src/Plugin/WebformElement/WebformButtonsOther.php
|+++ b/src/Plugin/WebformElement/WebformButtonsOther.php
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.

1 out of 1 hunk ignored
can't find file to patch at input line 442
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/src/Plugin/WebformElement/WebformCheckboxesOther.php b/src/Plugin/WebformElement/WebformCheckboxesOther.php
|index e792b149..89a0461a 100644
|--- a/src/Plugin/WebformElement/WebformCheckboxesOther.php
|+++ b/src/Plugin/WebformElement/WebformCheckboxesOther.php
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.

1 out of 1 hunk ignored
can't find file to patch at input line 460
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------

|diff --git a/src/Plugin/WebformElement/WebformRadiosOther.php b/src/Plugin/WebformElement/WebformRadiosOther.php
|index 9b94933a..5d156a07 100644
|--- a/src/Plugin/WebformElement/WebformRadiosOther.php
|+++ b/src/Plugin/WebformElement/WebformRadiosOther.php
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.

1 out of 1 hunk ignored
can't find file to patch at input line 479
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------

|diff --git a/src/Plugin/WebformElement/WebformSelectOther.php b/src/Plugin/WebformElement/WebformSelectOther.php
|index cb485043..4c69fe5a 100644
|--- a/src/Plugin/WebformElement/WebformSelectOther.php
|+++ b/src/Plugin/WebformElement/WebformSelectOther.php
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.

1 out of 1 hunk ignored
can't find file to patch at input line 498
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/src/Plugin/WebformElementBase.php b/src/Plugin/WebformElementBase.php
|index 8ba1692a..2bbf2778 100644
|--- a/src/Plugin/WebformElementBase.php
|+++ b/src/Plugin/WebformElementBase.php
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.

3 out of 3 hunks ignored
can't find file to patch at input line 551
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/src/Plugin/WebformElementInterface.php b/src/Plugin/WebformElementInterface.php
|index b2081a85..7a2adf50 100644
|--- a/src/Plugin/WebformElementInterface.php
|+++ b/src/Plugin/WebformElementInterface.php
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.

2 out of 2 hunks ignored

can't find file to patch at input line 601
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/src/Tests/Element/WebformElementComputedTest.php b/src/Tests/Element/WebformElementComputedTest.php
|index 39550203..6c0cdd49 100644
|--- a/src/Tests/Element/WebformElementComputedTest.php
|+++ b/src/Tests/Element/WebformElementComputedTest.php
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.

1 out of 1 hunk ignored
can't find file to patch at input line 614
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/src/Tests/Element/WebformElementHtmlEditorTest.php b/src/Tests/Element/WebformElementHtmlEditorTest.php
|index 162f2f14..7253a4ac 100644
|--- a/src/Tests/Element/WebformElementHtmlEditorTest.php
|+++ b/src/Tests/Element/WebformElementHtmlEditorTest.php
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.

1 out of 1 hunk ignored

can't find file to patch at input line 627
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/src/Tests/Element/WebformElementStatesTest.php b/src/Tests/Element/WebformElementStatesTest.php
|index 0d4fbc8e..d1d391aa 100644
|--- a/src/Tests/Element/WebformElementStatesTest.php
|+++ b/src/Tests/Element/WebformElementStatesTest.php
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.

1 out of 1 hunk ignored

can't find file to patch at input line 640
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/src/Tests/WebformEntityReferenceItemNormalizerTest.php b/src/Tests/WebformEntityReferenceItemNormalizerTest.php
|index 0579d76f..7664af70 100644
|--- a/src/Tests/WebformEntityReferenceItemNormalizerTest.php
|+++ b/src/Tests/WebformEntityReferenceItemNormalizerTest.php
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.

1 out of 1 hunk ignored

patching file b/src/Tests/WebformSubmissionStatesValidatorTest.php

can't find file to patch at input line 896
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/src/WebformRequestInterface.php b/src/WebformRequestInterface.php
|index cd75e96f..36c32d7a 100644
|--- a/src/WebformRequestInterface.php
|+++ b/src/WebformRequestInterface.php
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.

1 out of 1 hunk ignored
can't find file to patch at input line 910
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/src/WebformSubmissionForm.php b/src/WebformSubmissionForm.php
|index cf0ca121..2b5bcf80 100644
|--- a/src/WebformSubmissionForm.php
|+++ b/src/WebformSubmissionForm.php
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.

7 out of 7 hunks ignored

patching file b/src/WebformSubmissionStatesValidator.php

patching file b/src/WebformSubmissionStatesValidatorInterface.php

patching file b/tests/modules/webform_test/config/install/webform.webform.test_form_states_server_required.yml

patching file b/tests/modules/webform_test/config/install/webform.webform.test_form_states_server_wizard.yml

can't find file to patch at input line 2189
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/webform.services.yml b/webform.services.yml
|index e3fb59a5..483ea82e 100644
|--- a/webform.services.yml
|+++ b/webform.services.yml
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.

1 out of 1 hunk ignored

patch '-p2' --no-backup-if-mismatch -d 'web/modules/contrib/webform' < '/var/folders/hz/krf1btss1ngd_m5nm3vp6xwm0000gn/T/598dede297d66.patch'
can't find file to patch at input line 5
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/config/schema/webform.schema.yml b/config/schema/webform.schema.yml
|index a914588d..d81a6b28 100644
|--- a/config/schema/webform.schema.yml
|+++ b/config/schema/webform.schema.yml
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.

2 out of 2 hunks ignored
can't find file to patch at input line 35
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/js/webform.element.details.save.js b/js/webform.element.details.save.js
|index 9c8a066d..72191068 100644
|--- a/js/webform.element.details.save.js
|+++ b/js/webform.element.details.save.js
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.
1 out of 1 hunk ignored
can't find file to patch at input line 52
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------

|diff --git a/src/Element/WebformElementStates.php b/src/Element/WebformElementStates.php
|index 651cc38d..0f980f34 100644
|--- a/src/Element/WebformElementStates.php
|+++ b/src/Element/WebformElementStates.php
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.

1 out of 1 hunk ignored
can't find file to patch at input line 65
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/src/Element/WebformOtherBase.php b/src/Element/WebformOtherBase.php
|index 2c15d4a4..419bd243 100644
|--- a/src/Element/WebformOtherBase.php
|+++ b/src/Element/WebformOtherBase.php
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.

2 out of 2 hunks ignored
can't find file to patch at input line 98
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/src/Plugin/WebformElement/Checkboxes.php b/src/Plugin/WebformElement/Checkboxes.php
|index 1772ac8b..40055cf0 100644
|--- a/src/Plugin/WebformElement/Checkboxes.php
|+++ b/src/Plugin/WebformElement/Checkboxes.php
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.

2 out of 2 hunks ignored
can't find file to patch at input line 132

Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/src/Plugin/WebformElement/DateList.php b/src/Plugin/WebformElement/DateList.php
|index f1ceae10..d4b1db7a 100644
|--- a/src/Plugin/WebformElement/DateList.php
|+++ b/src/Plugin/WebformElement/DateList.php
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.

2 out of 2 hunks ignored
can't find file to patch at input line 202
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/src/Plugin/WebformElement/DateTime.php b/src/Plugin/WebformElement/DateTime.php
|index 62820201..a6bf0c69 100644
|--- a/src/Plugin/WebformElement/DateTime.php
|+++ b/src/Plugin/WebformElement/DateTime.php
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.

2 out of 2 hunks ignored
can't find file to patch at input line 243
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/src/Plugin/WebformElement/OptionsBase.php b/src/Plugin/WebformElement/OptionsBase.php
|index 649be0e2..0961ce45 100644
|--- a/src/Plugin/WebformElement/OptionsBase.php
|+++ b/src/Plugin/WebformElement/OptionsBase.php
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.

4 out of 4 hunks ignored
can't find file to patch at input line 411
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/src/Plugin/WebformElement/TextFormat.php b/src/Plugin/WebformElement/TextFormat.php
|index 56f8ee09..484e6531 100644
|--- a/src/Plugin/WebformElement/TextFormat.php
|+++ b/src/Plugin/WebformElement/TextFormat.php
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.
1 out of 1 hunk ignored
can't find file to patch at input line 423
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/src/Plugin/WebformElement/WebformButtonsOther.php b/src/Plugin/WebformElement/WebformButtonsOther.php
|index 26d40c06..8ae9842e 100644
|--- a/src/Plugin/WebformElement/WebformButtonsOther.php
|+++ b/src/Plugin/WebformElement/WebformButtonsOther.php
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.

1 out of 1 hunk ignored
can't find file to patch at input line 442
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/src/Plugin/WebformElement/WebformCheckboxesOther.php b/src/Plugin/WebformElement/WebformCheckboxesOther.php
|index e792b149..89a0461a 100644
|--- a/src/Plugin/WebformElement/WebformCheckboxesOther.php
|+++ b/src/Plugin/WebformElement/WebformCheckboxesOther.php
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.
1 out of 1 hunk ignored
can't find file to patch at input line 460
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/src/Plugin/WebformElement/WebformRadiosOther.php b/src/Plugin/WebformElement/WebformRadiosOther.php
|index 9b94933a..5d156a07 100644
|--- a/src/Plugin/WebformElement/WebformRadiosOther.php
|+++ b/src/Plugin/WebformElement/WebformRadiosOther.php
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.
1 out of 1 hunk ignored
can't find file to patch at input line 479
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/src/Plugin/WebformElement/WebformSelectOther.php b/src/Plugin/WebformElement/WebformSelectOther.php
|index cb485043..4c69fe5a 100644
|--- a/src/Plugin/WebformElement/WebformSelectOther.php
|+++ b/src/Plugin/WebformElement/WebformSelectOther.php
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.
1 out of 1 hunk ignored
can't find file to patch at input line 498
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/src/Plugin/WebformElementBase.php b/src/Plugin/WebformElementBase.php
|index 8ba1692a..2bbf2778 100644
|--- a/src/Plugin/WebformElementBase.php
|+++ b/src/Plugin/WebformElementBase.php
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.

3 out of 3 hunks ignored
can't find file to patch at input line 551
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/src/Plugin/WebformElementInterface.php b/src/Plugin/WebformElementInterface.php
|index b2081a85..7a2adf50 100644
|--- a/src/Plugin/WebformElementInterface.php
|+++ b/src/Plugin/WebformElementInterface.php
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.
2 out of 2 hunks ignored
can't find file to patch at input line 601
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/src/Tests/Element/WebformElementComputedTest.php b/src/Tests/Element/WebformElementComputedTest.php
|index 39550203..6c0cdd49 100644
|--- a/src/Tests/Element/WebformElementComputedTest.php
|+++ b/src/Tests/Element/WebformElementComputedTest.php
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.
1 out of 1 hunk ignored
can't find file to patch at input line 614
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/src/Tests/Element/WebformElementHtmlEditorTest.php b/src/Tests/Element/WebformElementHtmlEditorTest.php
|index 162f2f14..7253a4ac 100644
|--- a/src/Tests/Element/WebformElementHtmlEditorTest.php
|+++ b/src/Tests/Element/WebformElementHtmlEditorTest.php
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.
1 out of 1 hunk ignored
can't find file to patch at input line 627
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/src/Tests/Element/WebformElementStatesTest.php b/src/Tests/Element/WebformElementStatesTest.php
|index 0d4fbc8e..d1d391aa 100644
|--- a/src/Tests/Element/WebformElementStatesTest.php
|+++ b/src/Tests/Element/WebformElementStatesTest.php
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.
1 out of 1 hunk ignored
can't find file to patch at input line 640
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/src/Tests/WebformEntityReferenceItemNormalizerTest.php b/src/Tests/WebformEntityReferenceItemNormalizerTest.php
|index 0579d76f..7664af70 100644
|--- a/src/Tests/WebformEntityReferenceItemNormalizerTest.php
|+++ b/src/Tests/WebformEntityReferenceItemNormalizerTest.php
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.
1 out of 1 hunk ignored
patching file Tests/WebformSubmissionStatesValidatorTest.php
can't find file to patch at input line 896
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/src/WebformRequestInterface.php b/src/WebformRequestInterface.php
|index cd75e96f..36c32d7a 100644
|--- a/src/WebformRequestInterface.php
|+++ b/src/WebformRequestInterface.php
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.
1 out of 1 hunk ignored
can't find file to patch at input line 910
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/src/WebformSubmissionForm.php b/src/WebformSubmissionForm.php
|index cf0ca121..2b5bcf80 100644
|--- a/src/WebformSubmissionForm.php
|+++ b/src/WebformSubmissionForm.php
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.
7 out of 7 hunks ignored
patching file WebformSubmissionStatesValidator.php

patching file WebformSubmissionStatesValidatorInterface.php

patching file modules/webform_test/config/install/webform.webform.test_form_states_server_required.yml

patching file modules/webform_test/config/install/webform.webform.test_form_states_server_wizard.yml

missing header for unified diff at line 2189 of patch
can't find file to patch at input line 2189
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/webform.services.yml b/webform.services.yml
|index e3fb59a5..483ea82e 100644
|--- a/webform.services.yml
|+++ b/webform.services.yml
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.
1 out of 1 hunk ignored

   Could not apply patch! Skipping. The error was: Cannot apply patch https://www.drupal.org/files/issues/server_side_conditional-2900719-23.patch

Do you have a suggestion on how I can fix this issue?

Kat

jrockowitz’s picture

The patch has been committed to the latest dev release.

katannshaw’s picture

Well that was a brain fart moment... Thanks.

larowlan’s picture

+++ b/src/Plugin/WebformElement/Checkboxes.php
@@ -65,6 +66,21 @@ class Checkboxes extends OptionsBase {
+    if (in_array($option_value, $value)) {

FYI - this should use the third argument.

https://3v4l.org/oPqTY

jrockowitz’s picture

I was not aware of the third argument. I am surprised that it is not used more frequently in core.

https://www.drupal.org/project/issues/drupal?text=in_array+strict&versio...

I created a ticket to #2903561: Review in_array() usage and add the strict argument as needed.

  • jrockowitz authored 775d47c on 8.x-5.x
    Issue #2900719 by jrockowitz, larowlan: Server side Conditional Logic...
stiras’s picture

I am not sure if I can ask my question here or should I open a new issue, but since my question is related to that topic, I am posting it here.

I am using server-side conditional logic and everything works fine except for the file (document) upload field - it is marked as required but no validation is performed when no file is actually uploaded. When using required as FORM VALIDATION (not as CONDITIONAL LOGIC required) the validation works but that's not what I need.

Thanks for your help and time!

jrockowitz’s picture

Please open a new ticket.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.