Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Deprecate drupal_process_states()
as part of #2999721: [META] Deprecate the legacy include files before Drupal 9.
Proposed resolution
Add a new public static method \Drupal\Core\Form\FormHelper::processStates()
.
Remaining tasks
None.
User interface changes
None.
API changes
- New method
::processStates()
in class\Drupal\Core\Form\FormHelper
. drupal_process_states()
is deprecated.
Data model changes
None.
Comment | File | Size | Author |
---|---|---|---|
#19 | 3000068-19.patch | 14.85 KB | andypost |
#19 | interdiff.txt | 3.17 KB | andypost |
Comments
Comment #2
claudiu.cristeaPatch.
Comment #3
claudiu.cristeaComment #4
claudiu.cristeaForgot a wrong use statement.
Comment #6
andypostAs it more about any elements then maybe better to move it to
\Drupal\Core\Render\Element
?Comment #7
andypostReroll + added tests
Comment #8
andypostFunction does not return value, fixed test
Comment #9
claudiu.cristeaWhy was removed the end dot? I see that the official deprecation policy still adds a dot at the end https://www.drupal.org/core/deprecation:
Comment #10
andypostYes, that raised in drupal attributes and we need separate issue to make it consistent and another issue to fix coding standards
Btw my test is wrong because it passed in #7
Comment #11
andypostLink to "dot" #2677532-146: Move drupal_check_incompatibility() functionality to a new Dependency class and Version component
Comment #12
Mile23The period at the end of deprecation messages is inconsistent throughout core. It's an accident of English that incorrect but valid URL elements are also grammatically correct.
It's fine either way, until there's a coder rule for it, though I like it without the period.
+1 on more docs.
When this is in,
FormHelper
will have three methods:processStates()
,rewriteStatesSelector()
, andprocessStatesArray()
.processStatesArray()
is protected so we get a clue as to how (not to) use it, but it's still not very clear how it's different fromprocessStates(array $array)
. Especially with this remarkably unhelpful summary line: "Helper function for self::rewriteStatesSelector()."rewriteStatesSelector()
could have a more descriptive docblock, too.This is mostly a nit, tho if I encountered this helper without knowing it's history I'd be confused. Maybe this nit is out of scope here.
Comment #13
volegerComment #15
Mile23NW based on #12.
Comment #16
pingwin4egComment #17
pingwin4egUpdated doc blocks to be more clear. I did my best)
Comment #18
volegerCS issue, needs to be fixed.
Also version need to be updated 8.7.0 => 8.8.0.
Same here
Comment #19
andypostRe-roll & fix CS
Comment #21
johnwebdev CreditAttribution: johnwebdev commentedSeems to be a unrelated test fail. RTBC once ✅
Also updated change record.
Comment #22
johnwebdev CreditAttribution: johnwebdev commentedComment #24
catchCommitted 2a5c62d and pushed to 8.8.x. Thanks!