processwire / processwire-requests

ProcessWire feature requests.
39 stars 0 forks source link

Please make InputfieldPage::getPageLabel hookable #460

Open jmartsch opened 1 year ago

jmartsch commented 1 year ago

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

ryancramerdesign commented 5 months ago

@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.

jlahijani commented 5 months ago

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