Skip to content
Discussion options

You must be logged in to vote

You can customize an attribute’s HTML via Element::EVENT_DEFINE_ATTRIBUTE_HTML:

use craft\base\Element;
use craft\base\Event;
use craft\events\DefineAttributeHtmlEvent;

Event::on(Element::class, Element::EVENT_DEFINE_ATTRIBUTE_HTML, function (DefineAttributeHtmlEvent $event) {
    if ($event->attribute === 'myAttribute') {
        $event->html = '...';
    }
});

And you can override its inline HTML using Element::EVENT_DEFINE_INLINE_ATTRIBUTE_INPUT_HTML.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ryansupercool
Comment options

Answer selected by brandonkelly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
2 participants