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

Call Inputfield::renderReadyHook earlier so that hooks can set the collapsed state

Open Toutouwai opened this issue 7 months ago • 0 comments

Short description of the enhancement

I expected the collapsed state of an inputfield to be a part of the rendering of the inputfield, and so would be possible to set in a hook before Inputfield::renderReadyHook.

But this hook is called after InputfieldWrapper has already determined if the field will be AJAX-loaded or not, so it's not possible to achieve an AJAX-loaded inputfield by setting the collapsed property in a hook to Inputfield::renderReadyHook.

See these lines before $inputfield->renderReady() which in turn calls renderReadyHook().

If there are no unwanted side-effects, could $inputfield->renderReady() please be called before the AJAX-loading of an inputfield is determined so there's an opportunity to set it in a hook?

I know that InputfieldWrapper::renderInputfield is hookable but a hook to that will be triggered a great many times throughout the admin whereas a hook to renderReadyHook can be for an individual inputfield type, so there's less overhead (I think).

Toutouwai avatar Jul 25 '24 08:07 Toutouwai