Problem/Motivation

The drowl_paragraphs/admin library is not loaded when placing the first component, as the hook we use to add our library isn't called on create.

Once a paragraph exists, the form is loaded.

Steps to reproduce

See #3350177: Missing hook to alter ChooseComponentController::list or ::componentMenu for details

Proposed resolution

See #3350177: Missing hook to alter ChooseComponentController::list or ::componentMenu for details.

Remaining tasks

User interface changes

API changes

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Anybody created an issue. See original summary.

anybody’s picture

Looks like we need to replace

/**
 * Implements hook_form_layout_paragraphs_component_form_alter().
 */
function drowl_paragraphs_form_layout_paragraphs_component_form_alter(array &$form, FormStateInterface &$form_state){
  // Add backend library form to layout_paragraphs form:
    $form['#attached']['library'][] = 'drowl_paragraphs/admin';
}

to catch this case.

Let's try to use the more general

/**
 * Implements hook_preprocess_layout_paragraphs_builder().
 */
function drowl_paragraphs_preprocess_layout_paragraphs_builder(array &$variables) {
  // Add backend library form to layout_paragraphs builder form.
  $variables['#attached']['library'][] = 'drowl_paragraphs/admin';
}

instead. Hope it's the right one...

anybody’s picture

Assigned: anybody » Unassigned
Status: Active » Reviewed & tested by the community

Tested and works. I'll track #3350177: Missing hook to alter ChooseComponentController::list or ::componentMenu for possible updates / maintainer feedback from layout_paragraphs.

  • Anybody committed 0a3f9d98 on 4.x
    Issue #3350182 by Anybody: Library / style drowl_paragraphs/admin...
anybody’s picture

Status: Reviewed & tested by the community » Fixed

I'll tag a new release.

Status: Fixed » Closed (fixed)

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

anybody’s picture

Doesn't work or doesn't work anymore, really strange.

Here's the regression issue:
#3350177: Missing hook to alter ChooseComponentController::list or ::componentMenu