The poll form/results always appears above other fields regardless of the order specified in "Manage display"using drag & drop.
I was able to resolve this issue by changing the key name for the "Vote form/Results" field specified in poll_entity_extra_field_info() from ['poll_votes'] to ['poll'].
After making this change, flushing cache and reloading the Manage display page I am able to drag & drop fields to the desired order, save and the fields are displayed in the order expected.
I don't know if there is a better way to resolve this issue. However, I have not noticed any adverse side effects with this approach.
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | poll-3082110-12.patch | 5.2 KB | ivnish |
Issue fork poll-3082110
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:
- 3082110-2x
changes, plain diff MR !34
- 3082110-manage-display
changes, plain diff MR !17
Comments
Comment #2
berdirIf that works then that probably makes sense, nice catch. Since we got this wrong, it would be very useful to have test coverage for it though.
Comment #3
rjkuyvenhoven commentedI can see if I can find some time to do add test coverage. However, I don't have experience writing tests for Drupal and it's not clear to me how one would go about testing this particular issue.
Comment #4
berdirYeah, it isn't trivial.
We have \Drupal\poll\Tests\PollFieldTest::testPollFields() which tests that fields can be added and are displayed on edit & view.
So what we should do is set some weights there on the view display page, save that and then check the order of elemnts on the page.
Typically, that's done by getting the strpos() of the given strings in the page content, make sure they are not empty and are in the expected order.
Comment #5
ceseia commentedrjkuyvenhoven solution helps me as well
Comment #6
kunalgautam commentedPatch with fix phpunit as well
Comment #8
kunalgautam commentedComment #10
jidrone commentedAfter deeper testing I think the issue is related to how the entity theming is being managed.
There are other issues related like #3202785: Manage form display issue and #2936955: The order of output of fields before voting, I also had an issue using field group module.
I will start a merge request with an approach than can fix all of them.
Comment #12
ivnishComment #13
ivnishI rerolled MR to the latest dev of 2.0.x branch and added functional test of field weights
Comment #14
ivnish@bramdriesen can you review it?
Comment #15
bramdriesenWill convert the patch into an MR to see what the test results say.
Comment #17
bramdriesenTo me this is RTBC. Will check with @Berdir if this is ready to commit.
Comment #18
ivnishSuper! Can you contact with @Berdir?
Comment #19
berdirSeems like a sensible thing to do, especially in a new major branch.
> Super! Can you contact with @Berdir?
Berdir is always listening ;)
Comment #21
bramdriesenCommitted to 2.0.x, thanks all!
Comment #23
bramdriesen