Search code examples
cssmediawikimediawiki-extensionsmediawiki-templates

Changing the position and styling of particular label or button for a particular template in mediawiki?


I have an ApprovedRevs extension on my wiki and i want to change its position and color for a particular template. Currently, it is shown as a subtitle alongside the Title. I also want to convert it in a blue tick sign rather than an approved label.

Can anyone tell me which files should i affect and how should i do it ? Thanks in advance.


Solution

  • Basically ApprovedRevs use DisplayOldSubtitle hook to alter/add to original page subtitle, you may find a callback body at setSubtitle function in ApprovedRevs.hooks.php file.

    However in your case just modifying this code would not be enough - since you've mentioned that you need to alter styles and position only for pages which contain particular template.

    Depending on your exact needs you can:

    1. Either disable display of subtitle bundled with ApprovedRevs by removing a callback and implement own parser-function extension providing you with a custom parser-function like {{#approval_status:}} to fetch & display current state approval status with any custom styles you want - this way you can call this function somewhere in template so it'll not be run for other pages.

    2. Or you can go with a workaround which is limited in terms of changing subtitle position but should allow you to use own styles only for particular template based pages: modify your skin to add page categories as classes for body or html tag, eg.: for pages with Category Company it'll become <body class="category-company category-something">, then add a category to your template and after that you should be able to use this custom selector for styling based on page template via modifying Common.css page.