- last update
over 1 year ago Custom Commands Failed - πΊπΈUnited States rhovland Oregon
Here a version of the patch that works on 10.1
- last update
about 1 year ago 30,516 pass, 2 fail - πΊπΈUnited States rhovland Oregon
rhovland β changed the visibility of the branch 11.x to hidden.
- πΊπΈUnited States rhovland Oregon
rhovland β changed the visibility of the branch 10.1.x to hidden.
- πΊπΈUnited States rhovland Oregon
rhovland β changed the visibility of the branch 3029830-field-block-offsets to hidden.
- Merge request !9223Issue #3029830: Provide single field values from multivalue fields as layout builder-friendly blocks β (Open) created by rhovland
- πΊπΈUnited States rhovland Oregon
The old branch was empty so I made a new one based on 11.x
There's one test failure but it doesn't seem like it's related to these changes?
- π³πΏNew Zealand danielveza Brisbane, AU
I haven't done a comprehensive review of this yet since it's not green, but does the test need to be FunctionalJS? I think we can just do a Functional test here
- πͺπΈSpain javier_rey
I think that the patch #44 has a bug. If you set a field with βNumber of items to display = 0β, when you reach to the second "ifβ, the condition will be FALSE and will not hide unwanted fields.
if ($items_to_display = (int) $block_configuration['items_to_display']) {
// If this is a multi-value block configured to not display all values, // remove those field items from the render array. $block_configuration = $block->getConfiguration(); if (!$is_content_empty && isset($block_configuration['display_items']) && $block_configuration['display_items'] == 'display_some') { if ($items_to_display = (int) $block_configuration['items_to_display']) { $offset = (int) $block_configuration['offset']; $range = range(0, $content[0]['#items']->count()); foreach ($range as $key) { $top_range = $offset + $items_to_display - 1; if ($key < $offset || $key > $top_range) { $content[0][$key]['#access'] = FALSE; } } } }
- πΊπΈUnited States MegaKeegMan
I can confirm that bug. Also I wanted to mention that this particular solution will be a bit difficult to use, especially in the case that there are a lot of deltas in field. I wonder if it makes sense to also display the index of each delta in the preview to make it easier to select the values you are looking for
- πΊπΈUnited States MegaKeegMan
I went ahead and made a small change to patch #44 (I made against 10.3.x), which addresses both the bug and my need for an index to be displayed. I am happy to take any feedback, and if people like I can update the issue fork too. I pretty much just touched the code mentioned in #51.
- πΊπΈUnited States MegaKeegMan
Potential improvements to make on #53:
- make indices always display, even when offset and items to display are both 0
- Add block configuration to control whether the indices should be shown in the preview
- πΊπΈUnited States MegaKeegMan
Sorry #53 was still buggy, so ignore that one. This new one is what I meant for #53 to be. I did not make any improvements mentioned in #54. Again, this patch is for 10.3.x, but if the changes are agreeable, happy to commit them into the fork.
- πΊπΈUnited States MegaKeegMan
Oops I didn't realize that the changes I made affected things outside of preview mode. One more fix to make sure my index strings only show up in preview mode.
- πΊπΈUnited States MegaKeegMan
Okay one thing I really don't like about this implementation is that when you change the order of the deltas in the edit form, including when you delete a value, the items that you have displayed in the layout change.
- πΊπΈUnited States MegaKeegMan
But I acknowledge that this might be a feature for some people.
I ran testBlockAccess locally and it passed. The CI says that it failed:
https://git.drupalcode.org/issue/drupal-3029830/-/jobs/3186760