Attach library with command

Created on 28 October 2023, about 1 year ago
Updated 18 March 2024, 8 months ago

Problem/Motivation

The README currently says, you need to attach the library manually. Instead the library should be automatically attached with the command. I think that should be possible.

See https://drupal.stackexchange.com/questions/298035/ajax-form-add-library-... and the core commands.

See for example in Core:
https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Ajax%21Op...
https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Ajax%21Co...

I think the best example is this one:
https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Ajax%21An...

 /**
   * {@inheritdoc}
   */
  public function getAttachedAssets() {
    $assets = new AttachedAssets();
    $assets
      ->setLibraries([
      'core/drupal.announce',
    ]);
    return $assets;
  }

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Feature request
Status

Fixed

Version

1.0

Component

Code

Created by

🇩🇪Germany Anybody Porta Westfalica

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024