DefineCard Event


For anything a template can't do:

PHP
use bensomething\placard\events\DefineCardEvent;
use bensomething\placard\services\Generator;
use yii\base\Event;

Event::on(Generator::class, Generator::EVENT_DEFINE_CARD, function (DefineCardEvent $e) {
    if ($e->entry->section?->handle === 'home') {
        $e->title = 'My Brand';
        $e->label = '';
    }
});

The event has title, label, description, meta, background and backgroundColor, plus the card's resolved settings, which can be changed for that card alone. An empty value drops that element.