Module:Article history/doc: Difference between revisions

Content deleted Content added
Object documentation: add Message class documentation
finish the Row class docs
Line 14:
=== ArticleHistory ===
 
ArticleHistory objects can use all methods from the [[#Message|Message]] mixin. They also have the following public properties:
 
* <code>args</code> - a table of the arguments passed to the module by the user.
Line 37:
 
Calling <code>tostring()</code> on an ArticleHistory object gives you the HTML table made with ArticleHistory:renderHtml concatenated with the category links made with ArticleHistory:renderCategories.
 
=== Row ===
 
Row objects can use all methods from the [[#Message|Message]] mixin. They also have the following public properties:
 
* <code>currentTitle</code> - the same as ArticleHistory.currentTitle.
* <code>cfg</code> - the same as ArticleHistory.cfg.
* <code>isSmall</code> - the same as ArticleHistory.isSmall.
 
Row objects have the following public methods:
 
* <code>Row:getData(articleHistoryObj)</code> - get memoized data for the object that has been created with a makeData function in the module config page. This mechanism is used to stop config page functions from having to do the same data processing more than once. It must be passed an ArticleHistory object to find the data from.
* <code>Row:setIconValues(icon, caption, size, smallSize)</code> - set icon values for the object. <var>icon</var> is the icon filename without any namespace prefix, <var>caption</var> is a caption to use with the icon, <var>size</var> is the size of the icon when output with a large banner, and <var>smallSize</var> is the size of the icon when output with a small banner. <var>icon</var> and <var>caption</var> can be functions which take an ArticleHistory object as input and return the icon or caption value respectively. Sizes should include any suffixes, e.g. "30px".
* <code>Row:getIcon(articleHistoryObj)</code> - get the icon filename. It must be passed an ArticleHistory object. Returns nil if no icon was set.
* <code>Row:getIconCaption(articleHistoryObj)</code> - get the icon caption. It must be passed an ArticleHistory object. Returns nil if no caption was set.
* <code>Row:getIconSize()</code> - get the icon size.
* <code>Row:renderIcon(articleHistoryObj)</code> - renders the icon for the object. Returns nil if no icon was set.
* <code>Row:setNoticeBarIconValues(icon, caption, size)</code> - set notice bar icon values for the object. (The notice bar icons are the small icons that appear at the top left of the collapsible box containing the actions.) <var>icon</var> is the icon filename without any namespace prefix, <var>caption</var> is a caption to use with the icon, and <var>size</var> is the size of the icon. <var>icon</var> and <var>caption</var> can be functions which take an ArticleHistory object as input and return the icon or caption value respectively. Sizes should include any suffixes, e.g. "15px".
* <code>Row:getNoticeBarIcon(articleHistoryObj)</code> - get the notice bar icon filename. It must be passed an ArticleHistory object. Returns nil if no icon was set.
* <code>Row:getNoticeBarCaption(articleHistoryObj)</code> - get the notice bar icon caption. It must be passed an ArticleHistory object. Returns nil if no caption was set.
* <code>Row:getNoticeBarIconSize()</code> - get the notice bar icon size.
* <code>Row:exportNoticeBarIcon(articleHistoryObject)</code> - returns the rendered notice bar icon link. This method must be passed an ArticleHistory object.
* <code>Row:setText(text)</code> - set the text for the object to output. This may be a string or a function that takes an ArticleHistory object as input and returns the text as output.
* <code>Row:getText(articleHistoryObject)</code> - gets the row text. This method must be passed an ArticleHistory object.
* <code>Row:setCategories(val)</code> - sets the objects categories. <var>val</var> may be either an array of strings, or a function that takes an ArticleHistory object as input and returns an array of Category objects as output.
* <code>Row:getCategories(articleHistoryObj)</code> - returns an array containing the object's Category objects. This method must be passed an ArticleHistory object.
 
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox||