Problem/Motivation

In FormValidator:

> // If the session token was set by self::prepareForm(), ensure that it

There is no method prepareForm() in that class.

This probably dates back to when the class was made by moving code out of FormBuilder.

Steps to reproduce

Proposed resolution

Fix the docs to mention the right method.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3618255

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

joachim created an issue. See original summary.

bt dev2 made their first commit to this issue’s fork.

bt dev2’s picture

Hello there,

This is my first time I am working on a Drupal contribution. I forked the repository and updated the comment from self::prepareForm() to FormBuilder::prepareForm().

Please guide me if I did anything wrong.

Thanks

joachim’s picture

The comment should use the interface, FormBuilderInterface, and remember to use the full class name.

bt dev2’s picture

Thank you. I updated the comment and used the full class name.

\Drupal\Core\Form\FormBuilderInterface::prepareForm()
\Drupal\Core\Form\FormBuilderInterface::doBuildForm()

joachim’s picture

Sounds good -- and well spotted for the other method mention.

If your branch is ready, make a merge request for it.

joachim’s picture

Title: FormValidator refers to self::prepareForm() which doesn't exist » FormValidator refers to self::METHODS() which don't exist
Status: Active » Needs work

Looks good, but let's do this one too:

> // Additionally, self::doBuildForm() places the button value in

bt dev2’s picture

Updated the self::doBuildForm to \Drupal\Core\Form\FormBuilderInterface::doBuildForm().

I accidentally committed the composer.json file but reverted it.

Also added another commit to fix the coding standard.

joachim’s picture

Thanks!

Remember to set this to 'Needs review' when it's ready!

bt dev2’s picture

Status: Needs work » Needs review

Thank you. It is ready for review.

joachim’s picture

Status: Needs review » Reviewed & tested by the community

Looks great! Thanks!

longwave’s picture

Version: main » 10.6.x-dev
Status: Reviewed & tested by the community » Fixed

Backported down to 10.6.x as a docs only fix.

Committed and pushed 97b0f9ad086 to main and 3cd96c50fb0 to 11.x and 2069a869a6f to 11.4.x and 35db6630d4f to 10.6.x. Thanks!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • longwave committed 35db6630 on 10.6.x
    docs: #3618255 FormValidator refers to self::METHODS() which don't exist...

  • longwave committed 2069a869 on 11.4.x
    docs: #3618255 FormValidator refers to self::METHODS() which don't exist...

  • longwave committed 3cd96c50 on 11.x
    docs: #3618255 FormValidator refers to self::METHODS() which don't exist...

  • longwave committed 97b0f9ad on main
    docs: #3618255 FormValidator refers to self::METHODS() which don't exist...