Loading src/Entity/ComponentLibraryAsset.php +0 −6 Original line number Diff line number Diff line Loading @@ -45,7 +45,6 @@ use Drupal\Core\Entity\EntityStorageInterface; * config_export = { * "id", * "label", * "theme", * "files", * } * ) Loading @@ -62,11 +61,6 @@ final class ComponentLibraryAsset extends ConfigEntityBase { */ protected string $label; /** * The theme the component_library_asset entity is associated with. */ protected string $theme; /** * An array of file attributes with the following elements: * - 'code': The JS or CSS file contents. Loading src/Form/ComponentLibraryAssetForm.php +0 −36 Original line number Diff line number Diff line Loading @@ -5,37 +5,13 @@ declare(strict_types=1); namespace Drupal\component_library\Form; use Drupal\Core\Entity\EntityForm; use Drupal\Core\Extension\Extension; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Extension\ThemeHandlerInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** * The configuration form for component_library_asset entities. */ final class ComponentLibraryAssetForm extends EntityForm { protected ThemeHandlerInterface $themeHandler; /** * Constructs a new ComponentLibraryAssetForm. * * @param \Drupal\Core\Extension\ThemeHandlerInterface $theme_handler * The theme handler. */ public function __construct(ThemeHandlerInterface $theme_handler) { $this->themeHandler = $theme_handler; } /** * {@inheritdoc} */ public static function create(ContainerInterface $container): self { return new self( $container->get('theme_handler'), ); } /** * {@inheritdoc} */ Loading @@ -60,18 +36,6 @@ final class ComponentLibraryAssetForm extends EntityForm { '#disabled' => !$this->entity->isNew(), ]; $themes = $this->themeHandler->listInfo(); $themes = \array_filter($themes, fn (Extension $theme) => $this->themeHandler->hasUi($theme->getName())); $themes = \array_combine(\array_keys($themes), \array_keys($themes)); $form['theme'] = [ '#type' => 'select', '#title' => $this->t('Theme'), '#empty_option' => $this->t('- Select -'), '#default_value' => $form_state->getValue('theme') ?? $this->entity->get('theme') ?? '', '#options' => $themes, '#required' => TRUE, ]; $form['files'] = [ '#type' => 'fieldset', '#tree' => TRUE, Loading src/Form/ComponentOverrideForm.php +4 −1 Original line number Diff line number Diff line Loading @@ -626,7 +626,10 @@ final class ComponentOverrideForm extends EntityForm { } } $this->cacheDefault->set(self::COLLECTED_LIBRARIES_CID, $available_libraries, Cache::PERMANENT, ['library_info']); return $available_libraries; $component_library_libraries = $available_libraries['component_library']; // Move Component Libraries to the front of the line. unset($available_libraries['component_library']); return ['component_library' => $component_library_libraries] + $available_libraries; } } Loading Loading
src/Entity/ComponentLibraryAsset.php +0 −6 Original line number Diff line number Diff line Loading @@ -45,7 +45,6 @@ use Drupal\Core\Entity\EntityStorageInterface; * config_export = { * "id", * "label", * "theme", * "files", * } * ) Loading @@ -62,11 +61,6 @@ final class ComponentLibraryAsset extends ConfigEntityBase { */ protected string $label; /** * The theme the component_library_asset entity is associated with. */ protected string $theme; /** * An array of file attributes with the following elements: * - 'code': The JS or CSS file contents. Loading
src/Form/ComponentLibraryAssetForm.php +0 −36 Original line number Diff line number Diff line Loading @@ -5,37 +5,13 @@ declare(strict_types=1); namespace Drupal\component_library\Form; use Drupal\Core\Entity\EntityForm; use Drupal\Core\Extension\Extension; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Extension\ThemeHandlerInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** * The configuration form for component_library_asset entities. */ final class ComponentLibraryAssetForm extends EntityForm { protected ThemeHandlerInterface $themeHandler; /** * Constructs a new ComponentLibraryAssetForm. * * @param \Drupal\Core\Extension\ThemeHandlerInterface $theme_handler * The theme handler. */ public function __construct(ThemeHandlerInterface $theme_handler) { $this->themeHandler = $theme_handler; } /** * {@inheritdoc} */ public static function create(ContainerInterface $container): self { return new self( $container->get('theme_handler'), ); } /** * {@inheritdoc} */ Loading @@ -60,18 +36,6 @@ final class ComponentLibraryAssetForm extends EntityForm { '#disabled' => !$this->entity->isNew(), ]; $themes = $this->themeHandler->listInfo(); $themes = \array_filter($themes, fn (Extension $theme) => $this->themeHandler->hasUi($theme->getName())); $themes = \array_combine(\array_keys($themes), \array_keys($themes)); $form['theme'] = [ '#type' => 'select', '#title' => $this->t('Theme'), '#empty_option' => $this->t('- Select -'), '#default_value' => $form_state->getValue('theme') ?? $this->entity->get('theme') ?? '', '#options' => $themes, '#required' => TRUE, ]; $form['files'] = [ '#type' => 'fieldset', '#tree' => TRUE, Loading
src/Form/ComponentOverrideForm.php +4 −1 Original line number Diff line number Diff line Loading @@ -626,7 +626,10 @@ final class ComponentOverrideForm extends EntityForm { } } $this->cacheDefault->set(self::COLLECTED_LIBRARIES_CID, $available_libraries, Cache::PERMANENT, ['library_info']); return $available_libraries; $component_library_libraries = $available_libraries['component_library']; // Move Component Libraries to the front of the line. unset($available_libraries['component_library']); return ['component_library' => $component_library_libraries] + $available_libraries; } } Loading