Hello
I don't remember if there is already a system to locate specific parts of the templates for the prefilter system.
However it could be useful to have one (or more) in the properties panel of a photo
around here https://github.com/Piwigo/Piwigo/blob/13.7.0/admin/themes/default/template/picture_modify.tpl#L227
And not having to rely on ugly search-replace like this (which broke in v13) https://github.com/mistic100/Piwigo-PhotoSphere/blob/787a7a34ac787a59b0fdc038c541e43ffaa0c279/include/admin_events.inc.php#L44-L48
Thanks
<!-- github-sync-id:1778748421 -->
So it is with extra template variables. The problem with that is it requires to pre-render the content that must be added (and this is actually what I did in some of my old plugins).
I don't know which solution is better.
I was sure there was a similar system somewhere, and I found it !
https://github.com/Piwigo/Piwigo/blob/13.7.0/themes/default/template/picture.tpl#L9 (at lot of $PLUGIN_**** here)
So it is with extra template variables. The problem with that is it requires to pre-render the content that must be added (and this is actually [what I did](https://github.com/Piwigo/Piwigo-User-Collections/blob/master/include/events.inc.php#L245) in some of my old plugins).
I don't know which solution is better.
<!-- github-comment-id:1613463543 -->
In my opinion, a solution like {* loc_picture_modify_end_properties *}:
is dumb easy to implement (for both core developers and plugin developers)
has minimal impact on existing code relying on the search of an HTML specific code, it's just much simple to find/replace and 10 times more reliable (less subject to change on future versions)
no need to pre-render
I'm going to implement it this way for this specific request.
We're back to these discussions:
* https://piwigo.org/forum/viewtopic.php?id=20583
* https://piwigo.org/forum/viewtopic.php?id=23228
In my opinion, a solution like `{* loc_picture_modify_end_properties *}`:
* is dumb easy to implement (for both core developers and plugin developers)
* has minimal impact on existing code relying on the search of an HTML specific code, it's just much simple to find/replace and 10 times more reliable (less subject to change on future versions)
* no need to pre-render
I'm going to implement it this way for this specific request.
<!-- github-comment-id:1625388512 -->
I have a deeper concern about "new" forms in Piwigo administration, based on AJAX validation. Adding an input field in the form won't be enough to validate it. That's another issue, not related (yet) to admin/picture_modify but still a future issue. Piwigo 14 will switch to an AJAX validated form for admin/cat_modify.
I have a deeper concern about "new" forms in Piwigo administration, based on AJAX validation. Adding an input field in the form won't be enough to validate it. That's another issue, not related (yet) to `admin/picture_modify` but still a future issue. Piwigo 14 will switch to an AJAX validated form for `admin/cat_modify`.
<!-- github-comment-id:1625419219 -->
I totally understand your concern. This template architecture is good only for full server side rendering, now that interfaces become more dynamic and complex, it is equally more complex to make them extendable.
For the specific case of picture_modify I can think on one solution : expose an javascript API to add "widgets" to the form. A widget would contains a function to build the HTML, a function to set the value and a function to get the value to send the backend and bunch of other settings to display it (id, label, prefered position, etc). And couple that with an "handler" in the backend that will be able to process the widget value.
Just a quick idea, perhaps it is not worth it, perhaps it is not easily applicable to other screens.
Damn that's ten years ago !
I totally understand your concern. This template architecture is good only for full server side rendering, now that interfaces become more dynamic and complex, it is equally more complex to make them extendable.
For the specific case of picture_modify I can think on one solution : expose an javascript API to add "widgets" to the form. A widget would contains a function to build the HTML, a function to set the value and a function to get the value to send the backend and bunch of other settings to display it (id, label, prefered position, etc). And couple that with an "handler" in the backend that will be able to process the widget value.
Just a quick idea, perhaps it is not worth it, perhaps it is not easily applicable to other screens.
<!-- github-comment-id:1625973410 -->
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Hello
I don't remember if there is already a system to locate specific parts of the templates for the prefilter system.
However it could be useful to have one (or more) in the properties panel of a photo
around here https://github.com/Piwigo/Piwigo/blob/13.7.0/admin/themes/default/template/picture_modify.tpl#L227
And not having to rely on ugly search-replace like this (which broke in v13) https://github.com/mistic100/Piwigo-PhotoSphere/blob/787a7a34ac787a59b0fdc038c541e43ffaa0c279/include/admin_events.inc.php#L44-L48
Thanks
Hi @mistic100
You mean something like
{* PLACE 42 *}or something like this{$EXTRA_FIELDS}?I was sure there was a similar system somewhere, and I found it !
https://github.com/Piwigo/Piwigo/blob/13.7.0/themes/default/template/picture.tpl#L9 (at lot of $PLUGIN_**** here)
So it is with extra template variables. The problem with that is it requires to pre-render the content that must be added (and this is actually what I did in some of my old plugins).
I don't know which solution is better.
We're back to these discussions:
In my opinion, a solution like
{* loc_picture_modify_end_properties *}:I'm going to implement it this way for this specific request.
I have a deeper concern about "new" forms in Piwigo administration, based on AJAX validation. Adding an input field in the form won't be enough to validate it. That's another issue, not related (yet) to
admin/picture_modifybut still a future issue. Piwigo 14 will switch to an AJAX validated form foradmin/cat_modify.Damn that's ten years ago !
I totally understand your concern. This template architecture is good only for full server side rendering, now that interfaces become more dynamic and complex, it is equally more complex to make them extendable.
For the specific case of picture_modify I can think on one solution : expose an javascript API to add "widgets" to the form. A widget would contains a function to build the HTML, a function to set the value and a function to get the value to send the backend and bunch of other settings to display it (id, label, prefered position, etc). And couple that with an "handler" in the backend that will be able to process the widget value.
Just a quick idea, perhaps it is not worth it, perhaps it is not easily applicable to other screens.