Nicolas Posted November 27, 2024 Share Posted November 27, 2024 Is there a way to display/allow HTML tags in custom repeater label ? // CHange the label of the grape variety repeater $this->addHookAfter('InputfieldRepeater::renderRepeaterLabel', function(HookEvent $event) { $repeater = $event->object; if($repeater->name === 'grape_varieties') { $option_page = $event->arguments(2); $event->return = $option_page->title . '<span>(' . $option_page->color . ')</span>'; } }); Using the code above the span tag is escaped and not interpreted in the label. Link to comment Share on other sites More sharing options...
Robin S Posted November 27, 2024 Share Posted November 27, 2024 To do this I think you'll have to hook the rendering of the repeater item, which is a fieldset: $wire->addHookBefore('InputfieldFieldset(name^=repeater_item)::render', function(HookEvent $event) { $inputfield = $event->object; $inputfield->label = $event->wire()->sanitizer->unentities($inputfield->label); }); 2 Link to comment Share on other sites More sharing options...
Nicolas Posted November 28, 2024 Author Share Posted November 28, 2024 Thanks @Robin S, this hook did the trick 🙌 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now