Skins: Deprecation of various hooks and introducing SkinMustache

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Skins: Deprecation of various hooks and introducing SkinMustache

Jon Robson-2
Hello,

TLDR: The following hooks are deprecated in 1.35:
SkinTemplateBuildNavUrlsNav_urlsAfterPermalink,
SkinTemplatePreventOtherActiveTabs, SkinTemplateTabAction,
BaseTemplateAfterPortlet, SkinTemplateToolboxEnd, BaseTemplateToolbox,
 SkinTemplateOutputPageBeforeExe.

The longer version:
As part of the desktop improvements project
<http://mediawiki.org/wiki/Desktop%20improvements> we've been making some
exciting changes in MediaWiki's skin architecture. This has involved
migrating away from the BaseTemplate PHP class to Mustache as the render
engine for Vector. In 1.36, the Vector skin plans to use the new SkinMustache
class
<https://github.com/wikimedia/mediawiki/blob/master/includes/skins/SkinMustache.php>
and do away with the BaseTemplate class. This meant that we had to
deprecate various BaseTemplate hooks, providing more suitable generic
alternatives in the shared Skin.php layer. We also took the opportunity to
reduce the number of active hooks that operate in the skin layer for
developer sanity.

From now on it is intended that any skin modifications are done *prior *to
rendering. The renderer whether it is BaseTemplate or SkinMustache will
simply render the data that's been provided.

As a result of this I have various changes to report!

The *SidebarBeforeOutput
<https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Hooks/SidebarBeforeOutput>
*hook now can be used to modify the toolbox and languages portals.
Previously these sidebar menus had their own bespoke hooks.

The SkinTemplateBuildNavUrlsNav_urlsAfterPermalink hook
<https://www.mediawiki.org/wiki/Manual:Hooks/SkinTemplateBuildNavUrlsNav_urlsAfterPermalink>
is deprecated and can be replaced with the new and improved
SidebarBeforeOutput hook.

The SkinTemplatePreventOtherActiveTabs and SkinTemplateTabAction hooks
<https://phabricator.wikimedia.org/T253814>were seldom used and replaced
with SkinTemplateNavigation::Universal .

All BaseTemplate hooks should now be considered deprecated per T253809
<https://phabricator.wikimedia.org/T253809>.

   - BaseTemplateAfterPortlet
   <https://www.mediawiki.org/wiki/Manual:Hooks/BaseTemplateAfterPortlet>
   is replaced with the template-rendering agnostic SkinAfterPortlet
   <https://www.mediawiki.org/wiki/Manual:Hooks/SkinAfterPortlet>
   - SkinTemplateToolboxEnd
   <https://www.mediawiki.org/wiki/Manual:Hooks/SkinTemplateToolboxEnd>is
   replaced with the new and improved version of SidebarBeforeOutput
   - BaseTemplateToolbox
   <https://www.mediawiki.org/wiki/Manual:Hooks/BaseTemplateToolbox> is
   replaced  with the new and improved version of SidebarBeforeOutput


Finally a big one:
The SkinTemplateOutputPageBeforeExec hook is now deprecated
<https://phabricator.wikimedia.org/T60137>. Previously this hook could do a
lot of things and often in ways that were hard to reason with. For example,
previously this hook was used alongside other hooks to add items to the
footer and to override skin internals to display portals that were normally
hidden. We looked through all the use cases for this hook and are confident
we've caught the most confident use cases. Migration depends on what it was
previously used for but are documented on mediawiki.org
<https://www.mediawiki.org/wiki/Manual:Hooks/SkinTemplateOutputPageBeforeExec#Migration_notes>.
It's possible there are other use cases, we missed and if so we plan to
cover those during the 1.36 release.

If you are an extension developer and have any questions about migration
please feel free to ping me on the associated Phabricator ticket or hook
talk page, we will be happy to improve the documentation and help you find
the right way to upgrade your code.

As we go into 1.36 we plan to make changes that simplify MediaWiki skin
development and make the ecosystem friendlier to frontend developers and
make skins easier to maintain. In fact, in future, it will be possible to
write skins without a single line of PHP. If you are excited or intrigued
by these changes and want to get involved in the conversations I urge you
to subscribe to our board.
<https://phabricator.wikimedia.org/project/board/4795/>

I'm particularly interested in hearing from developers who are keen to make
skins in the new ecosystem. Your input and creativity would be much
appreciated. Feel free to drop me a private mail or engage in open
conversations.

In addition to all the extension developers who helped review changes to
their hook contracts, I would like to especially thank the following people
for getting us to this landmark: Ammarpad, Timo, Volker and Mainframe98.
I'd like to give a specific shout out for Ammarpad who has been a huge
driving force here, preventing various bugs from occurring and swiftly
responding to many of the unexpected regressions that we encountered during
this work. We couldn't have done this without you!

Thanks for reading!
Jon
_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: Skins: Deprecation of various hooks and introducing SkinMustache

Derick Alangi
Hi Jon,

Thanks to you and the team for the awesome work around various hook
deprecations in relation to the new skinning project :).

I second Jon's shout out to Ammarpad for the great work. Keep it up and I'm
glad you're working with Jon. Him and others within the Wikimedia developer
ecosystem are very good at guiding one become better at these things :).

Can't wait to see how skinning will have a turn around in the next couple
of years. Cheers!

*--*

*Derick A.*

*From One Developer to Another!*


On Tue, Jun 30, 2020 at 12:19 AM Jon Robson <[hidden email]> wrote:

> Hello,
>
> TLDR: The following hooks are deprecated in 1.35:
> SkinTemplateBuildNavUrlsNav_urlsAfterPermalink,
> SkinTemplatePreventOtherActiveTabs, SkinTemplateTabAction,
> BaseTemplateAfterPortlet, SkinTemplateToolboxEnd, BaseTemplateToolbox,
>  SkinTemplateOutputPageBeforeExe.
>
> The longer version:
> As part of the desktop improvements project
> <http://mediawiki.org/wiki/Desktop%20improvements> we've been making some
> exciting changes in MediaWiki's skin architecture. This has involved
> migrating away from the BaseTemplate PHP class to Mustache as the render
> engine for Vector. In 1.36, the Vector skin plans to use the new
> SkinMustache
> class
> <
> https://github.com/wikimedia/mediawiki/blob/master/includes/skins/SkinMustache.php
> >
> and do away with the BaseTemplate class. This meant that we had to
> deprecate various BaseTemplate hooks, providing more suitable generic
> alternatives in the shared Skin.php layer. We also took the opportunity to
> reduce the number of active hooks that operate in the skin layer for
> developer sanity.
>
> From now on it is intended that any skin modifications are done *prior *to
> rendering. The renderer whether it is BaseTemplate or SkinMustache will
> simply render the data that's been provided.
>
> As a result of this I have various changes to report!
>
> The *SidebarBeforeOutput
> <
> https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Hooks/SidebarBeforeOutput
> >
> *hook now can be used to modify the toolbox and languages portals.
> Previously these sidebar menus had their own bespoke hooks.
>
> The SkinTemplateBuildNavUrlsNav_urlsAfterPermalink hook
> <
> https://www.mediawiki.org/wiki/Manual:Hooks/SkinTemplateBuildNavUrlsNav_urlsAfterPermalink
> >
> is deprecated and can be replaced with the new and improved
> SidebarBeforeOutput hook.
>
> The SkinTemplatePreventOtherActiveTabs and SkinTemplateTabAction hooks
> <https://phabricator.wikimedia.org/T253814>were seldom used and replaced
> with SkinTemplateNavigation::Universal .
>
> All BaseTemplate hooks should now be considered deprecated per T253809
> <https://phabricator.wikimedia.org/T253809>.
>
>    - BaseTemplateAfterPortlet
>    <https://www.mediawiki.org/wiki/Manual:Hooks/BaseTemplateAfterPortlet>
>    is replaced with the template-rendering agnostic SkinAfterPortlet
>    <https://www.mediawiki.org/wiki/Manual:Hooks/SkinAfterPortlet>
>    - SkinTemplateToolboxEnd
>    <https://www.mediawiki.org/wiki/Manual:Hooks/SkinTemplateToolboxEnd>is
>    replaced with the new and improved version of SidebarBeforeOutput
>    - BaseTemplateToolbox
>    <https://www.mediawiki.org/wiki/Manual:Hooks/BaseTemplateToolbox> is
>    replaced  with the new and improved version of SidebarBeforeOutput
>
>
> Finally a big one:
> The SkinTemplateOutputPageBeforeExec hook is now deprecated
> <https://phabricator.wikimedia.org/T60137>. Previously this hook could do
> a
> lot of things and often in ways that were hard to reason with. For example,
> previously this hook was used alongside other hooks to add items to the
> footer and to override skin internals to display portals that were normally
> hidden. We looked through all the use cases for this hook and are confident
> we've caught the most confident use cases. Migration depends on what it was
> previously used for but are documented on mediawiki.org
> <
> https://www.mediawiki.org/wiki/Manual:Hooks/SkinTemplateOutputPageBeforeExec#Migration_notes
> >.
> It's possible there are other use cases, we missed and if so we plan to
> cover those during the 1.36 release.
>
> If you are an extension developer and have any questions about migration
> please feel free to ping me on the associated Phabricator ticket or hook
> talk page, we will be happy to improve the documentation and help you find
> the right way to upgrade your code.
>
> As we go into 1.36 we plan to make changes that simplify MediaWiki skin
> development and make the ecosystem friendlier to frontend developers and
> make skins easier to maintain. In fact, in future, it will be possible to
> write skins without a single line of PHP. If you are excited or intrigued
> by these changes and want to get involved in the conversations I urge you
> to subscribe to our board.
> <https://phabricator.wikimedia.org/project/board/4795/>
>
> I'm particularly interested in hearing from developers who are keen to make
> skins in the new ecosystem. Your input and creativity would be much
> appreciated. Feel free to drop me a private mail or engage in open
> conversations.
>
> In addition to all the extension developers who helped review changes to
> their hook contracts, I would like to especially thank the following people
> for getting us to this landmark: Ammarpad, Timo, Volker and Mainframe98.
> I'd like to give a specific shout out for Ammarpad who has been a huge
> driving force here, preventing various bugs from occurring and swiftly
> responding to many of the unexpected regressions that we encountered during
> this work. We couldn't have done this without you!
>
> Thanks for reading!
> Jon
> _______________________________________________
> Wikitech-l mailing list
> [hidden email]
> https://lists.wikimedia.org/mailman/listinfo/wikitech-l
_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l