Skip to content

[icons] Dispatch an event during ux:icons:lock  #2365

Open
@tacman

Description

@tacman

I'm using knp_dictionary to define icons by class:

    $containerConfigurator->extension('knp_dictionary', [
        'dictionaries' => [
            'class_icons' => [
                'type' => 'key_value',
                'content' => [
                    \App\Entity\Member::class => 'mdi:user',
                    \App\Entity\DirectoryCollection::class => 'mdi:users',
                    \App\Entity\Tag::class => 'mdi:tag',
                    \App\Entity\Donation::class => 'mdi:dollar',
                    \App\Entity\CommunicationLog::class => 'mdi:envelope',
                    \App\Entity\Event::class => 'tabler:calendar'
                ]
            ],

These work as expected in dev, as the ux_icon renderer fetches the icon on demand. I'd like to import them to production during the lock

bin/console ux:icons:lock

Of course, it doesn't now. My idea for implementation is dispatching an event that I could listen for and add the icons based on how I store them. For example, I recently discovered https://github.com/zenstruck/class-metadata and considered putting my icons there instead, e.g.

#[Metadata('icon', 'mdi:user')]
class User

In one project I have the icons as twig globals in twig.yaml.

In short, I'd like a way to register variable icons to make the discoverable during the lock command.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions