Dear,
When using Layout builder and having a multi value field being printed, for example twice, on a page via layout builder only prints out the first occurence. Please do note it only prints out the first occurence of the whole node, so multiple field_limiters on a page do not work.
This is related to
-
https://www.drupal.org/project/field_limiter/issues/3047981
π
Compatibility with layout builder?
Closed: outdated
-
https://www.drupal.org/project/field_limiter/issues/2943741 β
In the code:
/**
* {@inheritdoc}
*/
public function viewElements(FieldItemListInterface $items, $langcode) {
$field_values = $items->getValue();
$offset = $this->getSetting('offset');
// To show all elements, expressed by the setting '0', array_slice needs
// NULL as 3rd argument.
$limit = $this->getSetting('limit') == 0 ? NULL : $this->getSetting('limit');
// Let array_slice limit the field values to the ones we want to keep.
$limited_values = array_slice($field_values, $offset, $limit);
$items->setValue($limited_values);
// Generate the output of the field.
$field_output = $this->getFieldOutput($items, $langcode);
// Take the element children from the field output and return them.
$children = Element::children($field_output);
return array_intersect_key($field_output, array_flip($children));
}
We are setting: "$items->setValue($limited_values);
" and this thus overwrites it, and thus messing up the whole "render".
I also noted down that this is a problem related to Field Formatter. But I still wanted to note this down since this has a serious impact and people should know it before using this module.
Sidenote: Thank you for this module, without layout builder it works great.
When people are having issues with this related to LAyout Builder or the "re-save" this module: https://www.drupal.org/project/field_formatter_range β resolved the issue for me and this kinda the same.
Kind regards
Active
2.0
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.