Paragraphs actions button are removed when Claro admin theme is used

Created on 5 December 2019, about 5 years ago
Updated 30 August 2023, over 1 year ago

Problem/Motivation

When using the new experimental Claro admin theme, the paragraphs action buttons in the table header of field multiple value forms are overridden due to the implementation Claro uses to add a CSS class to the field label there.

This is what Claro does in claro_preprocess_field_multiple_value_form():

$variables['table']['#header'][0]['data'] = [
  '#type' => 'html_tag',
  '#tag' => 'h4',
  '#value' => $variables['element']['#title'],
  '#attributes' => $header_attributes,
];

Unfortunately, the Paragraphs module also changes the table structure to inject its buttons like this in paragraphs_preprocess_field_multiple_value_form():

if (!empty($variables['table']['#rows'][0]['data'][1]['data']['#paragraphs_header'])) {
  $variables['table']['#header'][0]['data'] = [
    'title' => $variables['table']['#header'][0]['data'],
    'button' => $variables['table']['#rows'][0]['data'][1]['data'],
  ];
  unset($variables['table']['#rows'][0]);
}

This has never been a problem, because Paragraphs assumed the structure created by template_preprocess_field_multiple_value_form() (can be found in core/includes/theme.inc) and acted on top of it. But Claro as a new player in the chain acts on top of that now - but also assumes the unchanged structure of template_preprocess_field_multiple_value_form() without any sub-items in that particular table header cell.

Proposed resolution

  • Discuss where to fix this issue. There are several locations that might need some changes for this:
    • template_preprocess_field_multiple_value_form() which might add the label with a dedicated key as a sub-item of the data property of the cell (so others can easily work on it)
    • claro_preprocess_field_multiple_value_form() which should be take in mind, that other contribs may change the structure of the table header cell's variable structure
    • paragraphs_preprocess_field_multiple_value_form() which may be tried to be moved to the end of the chain to work with the variable structure as usual... or a completely different approach may also be used?!

Remaining tasks

TBD

User interface changes

  • Paragraph actions buttons should be available with Claro again

API changes

n/a

Data model changes

n/a

Release notes snippet

n/a

πŸ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡©πŸ‡ͺGermany hctom

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024