Nicolas Posted Wednesday at 12:28 PM Share Posted Wednesday at 12:28 PM 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 Wednesday at 09:45 PM Share Posted Wednesday at 09:45 PM 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); }); 1 Link to comment Share on other sites More sharing options...
Nicolas Posted Thursday at 10:03 AM Author Share Posted Thursday at 10:03 AM 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