Jump to content

Recommended Posts

Posted

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)

ss.jpg

Posted

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 :)

Posted

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);
});

 

  • Like 1
Posted
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!

  • 2 weeks later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...