processwire-requests icon indicating copy to clipboard operation
processwire-requests copied to clipboard

Please make InputfieldPage::getPageLabel hookable

Open jmartsch opened this issue 3 years ago • 2 comments
trafficstars

I have a Page Reference field (ASM Select) and I am utilizing the "Custom Format" for the "Label field". However even the custom format itself is a bit limiting for a particular use case I have. It would be nice if we could hook into it and modify it to our needs via PHP.

Labels are generated inside InputfieldPage::getPageLabel method (\wire\modules\Inputfield\InputfieldPage\InputfieldPage.module), but unfortunately it's not hookable.

https://processwire.com/talk/topic/16970-modify-custom-page-label-format-via-hookapi/?do=findComment&comment=149098

jmartsch avatar Sep 24 '22 11:09 jmartsch

@jmartsch It's possible someone is extending that method in a descending glass, and making it hookable would break that. So rather than making it hookable, I have added a new hookable method InputfieldPage::renderPageLabel() and the getPageLabel() method now calls it, effectively producing the same result, if your goal is to modify the page label with a hook.

ryancramerdesign avatar Feb 09 '24 17:02 ryancramerdesign

@ryancramerdesign Thanks for this update. Can similar support be added for InputfieldPageAutocomplete?

jlahijani avatar Feb 09 '24 18:02 jlahijani