Support from Acquia helps fund testing for Drupal Acquia logo

Comments

andypost’s picture

Issue summary: View changes
Issue tags: +Needs manual testing
andypost’s picture

Issue summary: View changes
FileSize
4.94 KB
11.26 KB
andypost’s picture

Problem is \Drupal\contact\MessageForm::form() - preview have no weight assigned

fil00dl’s picture

Issue summary: View changes
Status: Active » Needs work
Issue tags: -Needs manual testing
FileSize
32.9 KB

Here is the test scenario to trigger the bug :

Part 1 :
Go to the bottom of front page and click on “contact”
Fill the “subject” and “message” fields and click on preview
Check the result: you should see the preview of your message under the message input area. It's the expected behavior.

Part 2 :
Go to /admin/structure/contact
Select “manage form display” for the selected contact form (“Website feedback”)
Sort fields by avoiding weight negative values
Save, restart the part 1 and see the result : contact message preview appears random form position.

Oleksiy’s picture

Issue summary: View changes
Status: Needs work » Needs review
FileSize
640 bytes

We can't simply set some static weight to the container preview, as it can be different for other fields according to “manage form display” Contact page settings. My suggestion is to make preview position configurable like any other Contact page field. Then we will have weight defined by default as well as a new weight for container preview if something will be changed in the display settings. Patch attached.

andypost’s picture

Issue tags: +Needs tests

Also we need test to make sure that preview is always on top (like min element weight -1)

+++ b/core/modules/contact/contact.module
@@ -77,6 +77,11 @@ function contact_entity_extra_field_info() {
+      'weight' => 40,

I won't work, because fields could be reordered in UI but preview should be always above

andypost’s picture

Status: Needs review » Needs work

for tests

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

larowlan’s picture

Assigned: Unassigned » larowlan

adding a test

larowlan’s picture

The last submitted patch, 10: 1867030-preview-position.fail_.patch, failed testing.

andypost’s picture

Thanx, looks great, just a question of BC... do we need update hook?

alexpott’s picture

#6 @andypost says that the field should always be on top... but the fix suggests that we allow re-ordering.

And yes I think we should have an update.

alexpott’s picture

Also #6 seems to contradict #4 - I think #4 is right - the preview should be at the bottom of the form by default.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Berdir’s picture

Yeah, it is at the bottom by default, so a default weight of 40 means there is a pretty good chance that it is still at the bottom by default when applying this patch.

I also don't think this needs an update function. Entity displays update themself automatically with extra and base field definitions, Manually verified that this works fine, it just needs a cache clear. We could add an empty update function to enforce that happens, but IMHO, that's overkill for an addition like this, there are probably other update functions and nothing is broken (not more than without the patch, that is) until you do clear the cache.

Patch unfortunately had a trivial conflict due to an array() => [] change, re-uploading, hope it's still OK if I RTBC.. attaching an actual diff of the two patches to show that I changed nothing, it's just the context that changed.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 16: 1867030-preview-position-16.patch, failed testing.

andypost’s picture

Status: Needs work » Reviewed & tested by the community

random fail

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 16: 1867030-preview-position-16.patch, failed testing.

Berdir’s picture

Status: Needs work » Reviewed & tested by the community

More random fails.

alexpott’s picture

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed 57fdb94 to 8.3.x and 05c29b2 to 8.2.x. Thanks!

  • alexpott committed 57fdb94 on 8.3.x
    Issue #1867030 by larowlan, Berdir, Oleksiy, andypost, fil00dl: Contact...

  • alexpott committed 05c29b2 on 8.2.x
    Issue #1867030 by larowlan, Berdir, Oleksiy, andypost, fil00dl: Contact...

  • alexpott committed 57fdb94 on 8.4.x
    Issue #1867030 by larowlan, Berdir, Oleksiy, andypost, fil00dl: Contact...

  • alexpott committed 57fdb94 on 8.4.x
    Issue #1867030 by larowlan, Berdir, Oleksiy, andypost, fil00dl: Contact...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.