Chris Falkenstein Posted August 31, 2017 Share Posted August 31, 2017 Hi all. I setup a repeater. I'd like to use a unique label for each repeater item. I opted to use the repeater's index number. Perfect, but it's adding the pound (#) sign in the label. Can I include the repeater index number without the pound sign? How? See my repeater item below (screen shot) Link to comment Share on other sites More sharing options...
adrian Posted August 31, 2017 Share Posted August 31, 2017 It works for me. Is that what you are looking for? Link to comment Share on other sites More sharing options...
adrian Posted August 31, 2017 Share Posted August 31, 2017 Sorry, ignore the stupidity in my last post - I did #1 instead of #n I'll look into it and get back to you in a minute Link to comment Share on other sites More sharing options...
adrian Posted August 31, 2017 Share Posted August 31, 2017 Sorry for the delay - I got sidetracked. You can fix this easily with a little hook magic. Place this in your /site/ready.php file: $this->addHookAfter("InputfieldRepeater::renderRepeaterLabel", function($event) { $return = $event->return; $event->return = str_replace('#', '', $return); }); 1 Link to comment Share on other sites More sharing options...
Chris Falkenstein Posted August 31, 2017 Author Share Posted August 31, 2017 Thanks. It worked. What's this ready.php file do? I suppose I need to create this? Link to comment Share on other sites More sharing options...
adrian Posted August 31, 2017 Share Posted August 31, 2017 1 minute ago, Chris Falkenstein said: Thanks. What's this ready.php file do? I suppose I need to create this? Yes, you will need to create it. Basically any code in that file will be run when ProcessWire is "ready". You can read more about it here: https://processwire.com/blog/posts/processwire-2.6.7-core-updates-and-more/#new-core-files-for-site-hooks 1 Link to comment Share on other sites More sharing options...
Chris Falkenstein Posted August 31, 2017 Author Share Posted August 31, 2017 Wonderus! Link to comment Share on other sites More sharing options...
adrian Posted August 31, 2017 Share Posted August 31, 2017 2 minutes ago, Chris Falkenstein said: Wonderus! Yeah, hooks are very cool and not as scary as they may first appear. Be sure to check out the Captain Hook panel in Tracy - it gives you a list of available hooks for each file/class/module in ProcessWire. It can take a little time to figure out what you should be looking for, but once you do, the skies the limit! Link to comment Share on other sites More sharing options...
Robin S Posted September 14, 2017 Share Posted September 14, 2017 That # symbol has bugged me too: https://github.com/processwire/processwire-issues/issues/284 When you look into the Repeater module code it seems very much like that symbol only exists to allow a Javascript fix to a problem that could be easily solved in the module PHP. 2 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