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.
In TextfieldWidget::errorElement()
there is the following comment.
// Ignore validation errors for formats if formats may not be changed,
// i.e. when existing formats become invalid. See filter_process_format().
There isn't any filter_process_format()
function, in Drupal 8 or higher.
That isn't the only comment with a reference to filter_process_format()
. git grep -n 'filter_process_format()'
gives the following list.
- core/modules/config_translation/src/FormElement/FormElementBase.php:141
* In the specific case of formatted text this logic is implemented by * utilizing a form element of type 'text_format' and its #format and * #allowed_formats properties. The access logic explained above is then * handled by the 'text_format' element itself, specifically by * filter_process_format(). In case such a rich element is not available for * translation of complex data, similar access logic must be implemented * manually.
- core/modules/config_translation/src/FormElement/FormElementBase.php:156
* @see \Drupal\config_translation\FormElement\TextFormat * @see filter_process_format()
- core/modules/editor/src/Element.php:50
// filter_process_format() copies properties to the expanded 'value' child // element, including the #pre_render property. Skip this text format // widget, if it contains no 'format'.
- core/modules/filter/src/Element/TextFormat.php:254
* To not break form processing and previews if a user does not have access to * a stored text format, the expanded form elements in filter_process_format() * are forced to take over the stored #default_values for 'value' and * 'format'. However, to prevent the unfiltered, original #value from being * displayed to the user, we replace it with a friendly notice here.
- core/modules/text/src/Plugin/Field/FieldWidget/TextareaWidget.php:51
// Ignore validation errors for formats if formats may not be changed, // i.e. when existing formats become invalid. See filter_process_format().
- core/modules/text/src/Plugin/Field/FieldWidget/TextfieldWidget.php:42
// Ignore validation errors for formats if formats may not be changed, // i.e. when existing formats become invalid. See filter_process_format().
The method that replaced filter_process_format()
is TextFormat::processFormat()
.
Some of the comments could also be better written, for example rewritten to the following comment.
// Ignore validation errors for formats that may not be changed, for
// example existing formats which became invalid.
// See TextFormat::processFormat().
Comment | File | Size | Author |
---|---|---|---|
#20 | interdiff_19-20.txt | 5.03 KB | himanshu_sindhwani |
#20 | 3110200-20.patch | 5.72 KB | himanshu_sindhwani |
#19 | interdiff_15-19.txt | 4.58 KB | tdnshah |
#19 | 3110200-19.patch | 5.8 KB | tdnshah |
Comments
Comment #2
xjmThanks for the report! This looks like a good novice issue.
Docs fixes are eligible for backport to the production branch.
While the function exists in D8, it's deprecated, so it'd make sense to fix this in D8 as well.Actually, according to the IS, it doesn't exist in D8 either. So definitely should be fixed in D8 as well.Comment #3
himanshu_sindhwani CreditAttribution: himanshu_sindhwani at Srijan | A Material+ Company for Drupal India Association commentedComment #4
himanshu_sindhwani CreditAttribution: himanshu_sindhwani at Srijan | A Material+ Company for Drupal India Association commentedHere is a patch replacing filter_process_format() with TextFormat::processFormat() in comments.
Comment #5
apadernoJust a small change: Since the sentence got shorter, some of the words that were in the next line can be moved up.
I would also use as instead of i.e.
Comment #6
himanshu_sindhwani CreditAttribution: himanshu_sindhwani at Srijan | A Material+ Company for Drupal India Association commentedHi @kiamlaluno, thanks for the suggestion but I can not move the words to above as it will be more than 80 words on one line. For me i.e., is making more sense than using 'as'.
Comment #7
Rkumar CreditAttribution: Rkumar as a volunteer and at Srijan | A Material+ Company for Drupal India Association commentedI tested the patch and it works fine.
Comment #8
apadernoi.e. can be moved on the previous line and the 80-character limit would still be respected. Actually, i.e. would end on column 77.
i.e. doesn't make more sense, and it's preferable to avoid it, especially when it's misused. Does the phrase following i.e. explain the previous phrase, or does it just give an example of formats that may not be changed? Are we ready to change the sentence to use e.g. instead of i.e. when the phrase following it is just an example of why a format may not be changed?
Comment #9
jyotimishra-developer CreditAttribution: jyotimishra-developer commentedComment #10
himanshu_sindhwani CreditAttribution: himanshu_sindhwani at Srijan | A Material+ Company for Drupal India Association commentedComment #11
himanshu_sindhwani CreditAttribution: himanshu_sindhwani at Srijan | A Material+ Company for Drupal India Association commentedHi @kiamlaluno, What I see here is the first phrase is an example of the second phrase which is why we are using i.e. and not e.g. here. The second phrase concludes the example given in the first phrase. On shifting i.e. to above line I see more than 80 characters. See the screenshot attached:
Comment #12
himanshu_sindhwani CreditAttribution: himanshu_sindhwani at Srijan | A Material+ Company for Drupal India Association commentedComment #13
jyotimishra-developer CreditAttribution: jyotimishra-developer commentedHi, Patch in #4 is working fine. This is RTBC from my side.
Comment #14
apadernoI noticed there are two occurrences of the same text. The change applies to only one of them.
Comment #15
apadernoComment #16
himanshu_sindhwani CreditAttribution: himanshu_sindhwani at Srijan | A Material+ Company for Drupal India Association commentedSeems great!. Marking this to RTBC.
Comment #17
jyotimishra-developer CreditAttribution: jyotimishra-developer commentedHi, the patch in #15, applied successfully on 8.8.x Drupal instance. Working as expected.
Great!!
Comment #18
xjmThanks everyone for fixing this stale documentation.
Just a note for @jyotimishra123: Thank you for reviewing this issue! The automated testing infrastructure tells us whether the patch applies, so we do not need people to review that. It is also not sufficient criteria for the issue to be marked "Reviewed and Tested by the Community". Saying the patch is working as expected also does not give us enough information about what it means. When you do post a review, be sure to describe what you reviewed and how. This helps other reviewers understand why you considered the issue RTBC (and is considered for issue credit). In this issue, that might involve reviewing that all the changes were correct and clear documentation, followed coding standards, and accounted for all the instances in core. Thanks!
One change we need to make in the patch is that we need to se the fully qualified namespace everywhere for
TextfieldWidget
, which I think is something like\Drupal\text\Plugin\Field\FieldWidget\TextFieldWidget
. Thanks!Comment #19
tdnshah CreditAttribution: tdnshah as a volunteer and at Srijan | A Material+ Company for Drupal India Association commentedImplementing suggestion in #18
thank you
Comment #20
himanshu_sindhwani CreditAttribution: himanshu_sindhwani at Srijan | A Material+ Company for Drupal India Association commentedThe namespace used in #19 is incorrect, added the correct namespace, and fixed the spacing the issues in #19.
Comment #21
tdnshah CreditAttribution: tdnshah as a volunteer and at Srijan | A Material+ Company for Drupal India Association commentedOhh thanks for correcting @himanshu_sindhwani
Comment #22
apadernoThe class name is fully qualified and all the points raised in the previous comments has been implemented.
Comment #23
xjmYep thanks @himanshu_sindhwani, and apologies to @tdnshah for not being more clear that I was not sure of the correct namespace and that it would need to be checked before putting it in the patch. :) The namespace can be confirmed in the processFormat() documentation.
The word "See" here could fit on the previous line in both cases, but I suppose it's OK as-is also.
Comment #28
xjmThere's also a couple rewordings in there that are slightly out of scope, but I'll commit it in the one patch for now. In general be careful to not introduce changes outside the scope of the issue, since this can make the issue harder to review and commit.
Committed to 9.1.x, and cherry-picked to 9.0.x, 8.9.x, and 8.8.x as a documentation improvement. Thanks!