Problem/Motivation

The individual theming templates expected for SelectForm and TextForm are not implemented correctly.

Steps to reproduce

Visit /examples/theming_example/form_select and /examples/theming_example/form_text

Proposed resolution

Explicitly state $form['#theme'] in each form's buildForm() method, modify existing TextForm template to use {{ form }} instead of {{ text_form }}, add template for SelectForm.

Remaining tasks

None, see merge request.

User interface changes

None.

API changes

None.

Data model changes

None.

Issue fork examples-3222240

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

bsuttis created an issue. See original summary.

avpaderno’s picture

Version: 3.x-dev » 4.0.x-dev
Component: Theming Example » Code

oily made their first commit to this issue’s fork.

oily changed the visibility of the branch 3222240-selectform-and-textform to hidden.

oily changed the visibility of the branch 3.x to hidden.

oily changed the visibility of the branch 3222240-selectform-and-textform to active.

oily’s picture

Status: Active » Needs review
avpaderno’s picture

Title: SelectForm and TextForm theming not correct » SelectForm and TextForm are not correctly themed
avpaderno’s picture

Version: 4.0.x-dev » 5.0.x-dev
oily’s picture

I have tested the theming_example module on branch 5.0.x on Drupal 12.x-dev.

Running the functional test led to an exception: Exception: Functional/FunctionalJavascript test classes must specify the #[RunTestsInSeparateProcesses] attribute

Running ThemingExampleTest.php led to 4x deprecations and a test failure. These can be cured by adding array and string return types to both the forms on the ::buildForm() and ::getFormId() methods respectively.

After also adding the #[RunTestsInSeparateProcesses] attribute to the test class, the test passed.

It seems that most of the examples tests are FunctionalJavascript tests. They now need the #[RunTestsInSeparateProcesses] for the tests to run cleanly. This is a blocker to the tests as it masks the 'real' results of the tests.

I am adding it as a task in a follow up.

avpaderno’s picture

PHPUnit tests need some work; that is why GitLab CI has been set not to run them.
For example, there are many tests which verify the routes defined by the modules are accessible, which is not what tests should do. (Those tests also hard code the module's route paths.) Tests are for verifying new commits do not introduce errors which are then difficult to notice.

oily’s picture

Re: #14, I was wondering why the tests had been disabled.. Makes sense.

Tests are for verifying new commits do not introduce errors which are then difficult to notice

Agreed. Would be good to start with lowest hanging fruit (easiest of the modules to create tests for). And to maybe create an issue. In it, to define exactly which errors the tests need to prevent?..

oily changed the visibility of the branch 3222240-selectform-and-textform to hidden.

oily’s picture

I think this is ready for another review.

avpaderno’s picture

Status: Needs review » Reviewed & tested by the community

  • avpaderno committed d8eb5cfa on 5.0.x authored by oily
    Issue #3222240: SelectForm and TextForm are not correctly themed
    
avpaderno’s picture

Status: Reviewed & tested by the community » Fixed

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.