Comments

gantal created an issue. See original summary.

gantal’s picture

StatusFileSize
new30.86 KB

An initial patch adding an API for plugins to provide summaries for themselves.

gantal’s picture

StatusFileSize
new41.38 KB

The updated patch adds summary functionality for global segment sets.

gantal’s picture

Status: Active » Needs review
switzern’s picture

Assigned: Unassigned » gantal
Status: Needs review » Needs work

Hey @gantal - I've started testing this patch and was able to apply it to the HEAD of the 3.x dev branch without issues. However, when I try to view a segment set I get the following error:

Class 'Drupal\smart_content\SegmentSetStateHandler' not found in Drupal\smart_content\Form\SegmentSetConfigEntityForm->buildWidget() (line 187 of modules/contrib/smart_content/src/Form/SegmentSetConfigEntityForm.php).

Looking in modules/contrib/smart_content/src, I don't see SegmentSetStateHandler in there at all - it looks like that was excluded from your patch. Could you take a look and re-roll the patch with that included?

gantal’s picture

Status: Needs work » Needs review
StatusFileSize
new46.62 KB
new5.6 KB

Updated the patch to include previously untracked new classes! And an interdiff.

gantal’s picture

Assigned: gantal » Unassigned
switzern’s picture

Assigned: Unassigned » switzern
switzern’s picture

Assigned: switzern » gantal
Status: Needs review » Needs work

Thanks for the updated patch @gantal. This one applied cleanly and I am now able to access all of the pages I need to test and I see the expand/collapse functionality available. I tested two scenarios in each of three locations around the site:

Scenarios

  1. Create and save new Segment Set
  2. Edit and save existing Segment Set

Locations

  1. Create/edit Segment Set directly at /admin/structure/smart_content_segment_set
  2. Create/edit Segment Set in Layout Builder modal
  3. Create/edit Segment Set on core Block Layout page

I came across a couple bugs in each location and scenario where new or updated values are not saved if the summary is collapsed before the page is saved. Here's how those bugs manifested in each place:

Editing Segment Set directly

  • Changes to Segments are not saved if the Segment is collapsed before the Segment Set is saved.
  • If I edit the value of a condition in the default Segment, collapse the Segment and save the page, the "Set as default segment" boolean is unchecked and the updated value of the condition is not saved.

Create/edit Segment Set in Layout Builder modal

  • Create new custom segment set, add condition, add block, collapse and save. Condition value is not saved. Block appears to save, but does not display in the preview when I reopen the Decision Block to edit.

Create/edit Segment Set on core Block Layout page

  • Create new custom segment set, add condition, add block, collapse and save. Condition value is not saved. Block appears to save, but does not display in the preview when I reopen the Decision Block to edit.

Let me know if you need more detailed information about how to recreate.

michaellander’s picture

Issue tags: +RC blocker
gantal’s picture

StatusFileSize
new46.42 KB
new10.26 KB

Slight improvement in this one: decision blocks should collapse/save correctly but global segments still won't save correctly on collapse, for some reason.

michaellander’s picture

StatusFileSize
new46.62 KB
new1.09 KB

This should correct the issue on global segment sets.

michaellander’s picture

Status: Needs work » Needs review
switzern’s picture

Assigned: gantal » michaellander
Status: Needs review » Needs work

Hey @michaellander - Your patch in #12 applies cleanly against 3.x-beta3 for me. I went through all of the test cases I mentioned in #9 and made sure to test each of the bugs I reported there. Everything seems to be resolved with the exception of the issues with the value of the "Set as default segment" checkbox losing its value when the Segment Set is collapsed before it is saved. I've broken each issue out into the use case where I saw it below:

Create/edit global Segment Set

  • If I edit the default segment and collapse without first saving the Segment Set, "Set as default segment" is unchecked.

Create/edit Segment Set in Layout Builder modal

  • If I edit the default segment and collapse without first saving the block, "Set as default segment" is unchecked.

Create/edit Segment Set on core Block Layout page

  • If I edit the default segment and collapse without first saving the block, "Set as default segment" is unchecked.

Let me know if you need any more information or clarification.

michaellander’s picture

StatusFileSize
new46.79 KB
new2.23 KB

This should correct the default not saving. I think we need to do some testing around multiple defaults being set however. I also want to make sure we are properly validating form elements on collapse.

michaellander’s picture

It looks like we are good on avoiding multiple defaults, so now it's down to properly validating subforms. Once we confirm that's working as expected, we can move back to 'Needs Review'.

michaellander’s picture

Status: Needs work » Needs review
StatusFileSize
new49.92 KB
new5.14 KB

This should add proper validation on collapse. I think now we are down to code cleanup.

I'd also like to make sure we test multiple decision blocks on the same page, referencing the same exact segment set.

An example of this would be a block field, reference 2 separate decision blocks and the same segment set. We need to confirm that the collapse and expand don't affect both of them.

michaellander’s picture

Status: Needs review » Needs work

Need to add the summary functionality to decision blocks with a global segment set selected. Otherwise we are looking good!

gantal’s picture

Status: Needs work » Needs review
StatusFileSize
new53.21 KB
new5.75 KB

This adds the summary functionality we know and love to selected segment set widgets.

switzern’s picture

Status: Needs review » Reviewed & tested by the community

Hey @michaellander and @gantal - This is working great for me! The patch in #19 applies cleanly and works as advertised. All of the issues I previously mentioned are fixed. Here is a list of all the cases I tested:

  1. Create and save new global segment set at /admin/structure/smart_content_segment_set
  2. Edit existing global segment set at global segment set at /admin/structure/smart_content_segment_set
  3. Create new custom segment set in a decision block placed with Layout Builder
  4. Edit existing custom segment set in a decision block placed with Layout Builder
  5. Create new custom segment set in a decision block placed with core block layout UI
  6. Edit existing custom segment set in a decision block placed with core block layout UI

Let me know if you need clarification on any of the cases I tested. As far as I'm concerned this is ready to go, so I'm marking this as RTBC.

gantal’s picture

StatusFileSize
new53.65 KB
new9 KB

No new functionality in this patch but it adds some coding standard fixes for the patch in #19.

michaellander’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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