The Blueprint skin uses data['title'], which doesn't work well [1] if a page uses
{{DISPLAYTITLE:<span style="blah blah">{{FULLPAGENAME}}</span>}}
to hide its title as suggested [2].
Manual:Skinning [3] doesn't explain where data['*somekey*'] comes from or what the keys are. No problem, in a skin if you var_dump( $this->data ) there are a dozen other title-like keys to choose from. But how do skin developers know which one to use? titletxt, titletext, titleprefixeddbkey, thispage, ... Some are set(), some are setRef(), is that significant?
It seems the best you can do is read the source code of includes/skins/SkinTemplate.php and work back through its getOutput(), getTitle(), and getRelevantTitle() to OutputPage and the maze of title class methods to figure out which one does what you want. Too hard for me.
Thanks for any suggestions, I'll try to improve the documentation.
[1] https://phabricator.wikimedia.org/T103454 [2] https://www.mediawiki.org/wiki/Manual:FAQ#How_do_I_hide_the_main_page_title.... [3] https://www.mediawiki.org/wiki/Manual:Skinning
On 2015-06-23 12:00 AM, S Page wrote:
The Blueprint skin uses data['title'], which doesn't work well [1] if a page uses
{{DISPLAYTITLE:<span style="blah blah">{{FULLPAGENAME}}</span>}}
to hide its title as suggested [2].
Manual:Skinning [3] doesn't explain where data['*somekey*'] comes from or what the keys are. No problem, in a skin if you var_dump( $this->data ) there are a dozen other title-like keys to choose from. But how do skin developers know which one to use? titletxt, titletext, titleprefixeddbkey, thispage, ... Some are set(), some are setRef(), is that significant?
title should be correct. Manual:Skinning is the most up to date documentation on the topic, written after most of the DISPLAYTITLE stuff has long since been implemented. (CoI Disclaimer: I wrote it)
Most of the other title keys in data especially ones like titleprefixeddbkey should really just the same title (not sure if it's the getTitle() or getRelevantTitle() title) in the different string formats you'd get out of $title->getText(), $title->getPrefixedDbKey(), etc...
Nowadays I'd consider them worthless or silently deprecated. Just grab the Title instance you want and use the right method on that instance. The data attributes are there because some time in the distant distant past someone either thought they were a good idea or maybe MW was using a really old template engine that only accepted the strings and could not work with a title instance. And they exist currently I guess because we don't know if they can safely be killed and keys in an array are hard to deprecate in something like skins which probably have more private custom implementations then extensions would have. (That, and no one has bothered trying to remove them ;)).
set vs. setRef is an implementation detail you don't have to worry about. setRef just acts like set but uses a PHP reference (&$foo) so that the value changes when the variable outside ->data changes.
~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://danielfriesen.name/]
wikitech-l@lists.wikimedia.org