- Status changed to RTBC
8 months ago 7:14pm 5 April 2024 - πΊπΈUnited States devkinetic
Thanks for the report. I've reviewed the patch and all looks well. marking as RTBC, and slated for merge.
When enabled, the Field Config Cardinality module removes the "Collapse All / Drag & Drop / Edit All" dropdown provided by the Paragraphs Experimental Widget.
Create a paragraph, add an entity reference revisions field to another paragraph type, and set the form display to Paragraphs Experimental widget. There should be 3 dots in the top right of the widget. When Field Config Cardinality is enabled, these dots are missing.
On line 152 of the module file, the module implements HOOK_preprocess_field_multiple_value_form().
I'm probably missing something, but in my testing, removing everything inside this function after line 183 (not including that line) fixes the issue, but still allows the cardinality to be set and respected at the instance level.
So, the entire content of that function would be:
function field_config_cardinality_preprocess_field_multiple_value_form(&$variables) {
$element = $variables['element'];
$variables['multiple'] = FALSE;
if (!empty($element['#cardinality_multiple'])) {
$variables['multiple'] = $element['#cardinality_multiple'];
}
else if (!empty($element['#multiple'])) {
$variables['multiple'] = $element['#multiple'];
}
if ($variables['multiple'] == TRUE && isset($element['#attributes']['data-fcc'])) {
$cardinality_config = $element['#attributes']['data-fcc'];
if (!empty($cardinality_config)) {
$order_class = $element['#field_name'] . '-delta-order';
$rows = [];
// Sort items according to '_weight' (needed when the form comes back after
// preview or failed validation).
$items = [];
$variables['button'] = [];
foreach (Element::children($element) as $key) {
if (is_integer($key)) {
$items[] = &$element[$key];
}
}
if (count($items) <= $cardinality_config - 1 || $cardinality_config == '-1') {
$variables['button'] = &$element['add_more'];
}
usort($items, '_field_multiple_value_form_sort_helper');
}
}
}
Testing.
None.
None.
None.
1.0
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
Thanks for the report. I've reviewed the patch and all looks well. marking as RTBC, and slated for merge.