CollaborationKit
MediaWiki CollaborationKit extension
Loading...
Searching...
No Matches
CollaborationListContent Class Reference
+ Inheritance diagram for CollaborationListContent:
+ Collaboration diagram for CollaborationListContent:

Public Member Functions

 __construct ( $text, $type='CollaborationListContent')
 
 isValid ()
 Decode and validate the contents.
 
 beautifyJSON ()
 Format JSON.
 
 getDescription ()
 
 convertToWikitext (Language $lang, $options=[])
 Convert the JSON to wikitext.
 
 convert ( $toModel, $lossy='')
 Converts between different text-based content models.
 
 getDefaultOptions ()
 Default rendering options.
 
 convertToHumanEditable ()
 Convert JSON to markup that's easier for humans.
 
 getHumanEditableList ()
 Get the list of items in human editable form.
 

Static Public Member Functions

static convertFromHumanEditable ( $text)
 Convert from human editable form into a (php) array.
 
static transcludeHook ( $parser, $pageName='',... $args)
 Function to handle {{#trancludelist:Page name|options...}} calls.
 
static loadStyles ( $content, array $attributes, Parser $parser)
 Hack to allow styles to be loaded from plain transclusion.
 
static onArticleViewHeader (Article $article)
 Hook used to determine if current user should be given the edit interface for a page.
 
static onBeforePageDisplay (OutputPage $out, $skin)
 Hook to add timestamp for edit conflict detection.
 
static onCustomEditor (Page $page, User $user)
 Hook to use custom edit page for lists.
 

Public Attributes

const MAX_LIST_SIZE = 2000
 
const RANDOM_CACHE_EXPIRY = 28800
 
const MAX_TAGS = 50
 
const HUMAN_COLUMN_SPLIT = "\n---------~-~---------\n"
 
const HUMAN_COLUMN_SPLIT2 = "\n---------------------\n"
 

Protected Member Functions

 decode ()
 Decode the JSON contents and populate protected variables.
 
 fillParserOutput (Title $title, $revId, ParserOptions $options, $generateHtml, ParserOutput &$output)
 Fill $output with information derived from the content.
 

Static Protected Member Functions

static generateImage ( $definedImage, $displayMode, $title, $size=32)
 Invokes CollaborationKitImage::makeImage with fallback criteria.
 

Protected Attributes

 $description
 
 $options
 
 $columns
 
 $displaymode
 
 $errortext
 

Constructor & Destructor Documentation

◆ __construct()

CollaborationListContent::__construct ( $text,
$type = 'CollaborationListContent' )
Parameters
string$text
string$type

Member Function Documentation

◆ beautifyJSON()

CollaborationListContent::beautifyJSON ( )

Format JSON.

Do not escape < and > it's unnecessary and ugly

Returns
string

◆ convert()

CollaborationListContent::convert ( $toModel,
$lossy = '' )

Converts between different text-based content models.

Parameters
string$toModelThe desired content model, use the CONTENT_MODEL_XXX flags.
string$lossyFlag, set to "lossy" to allow lossy conversion. If lossy conversion is not allowed, full round-trip conversion is expected to work without losing information.
Returns
Content|bool A content object with the content model $toModel.
+ Here is the call graph for this function:

◆ convertFromHumanEditable()

static CollaborationListContent::convertFromHumanEditable ( $text)
static

Convert from human editable form into a (php) array.

Parameters
string$texttext to convert
Returns
array Result of converting it to native form
Exceptions
MWContentSerializationException
+ Here is the caller graph for this function:

◆ convertToHumanEditable()

CollaborationListContent::convertToHumanEditable ( )

Convert JSON to markup that's easier for humans.

Returns
string
+ Here is the call graph for this function:

◆ convertToWikitext()

CollaborationListContent::convertToWikitext ( Language $lang,
$options = [] )

Convert the JSON to wikitext.

Parameters
Language$langThe (content) language to render the page in.
array$optionsOptions to override the default transclude options
Returns
string The wikitext
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fillParserOutput()

CollaborationListContent::fillParserOutput ( Title $title,
$revId,
ParserOptions $options,
$generateHtml,
ParserOutput & $output )
protected

Fill $output with information derived from the content.

Parameters
Title$title
int$revIdRevision ID
ParserOptions$options
bool$generateHtml
ParserOutput&$output
+ Here is the call graph for this function:

◆ generateImage()

static CollaborationListContent::generateImage ( $definedImage,
$displayMode,
$title,
$size = 32 )
staticprotected

Invokes CollaborationKitImage::makeImage with fallback criteria.

Parameters
string | null$definedImageThe filename given in the list item
string$displayModeType of list (members or otherwise)
Title | null$titleTitle object of the list item
int$sizeThe width of the icon image. Default is 32px;
Returns
string HTML
+ Here is the call graph for this function:

◆ getDefaultOptions()

CollaborationListContent::getDefaultOptions ( )

Default rendering options.

These are used when rendering a list and no option value was specified. getFullRenderListOptions() will override some of these values when a list page is directly viewed.

Any new option must be added to this list.

Returns
array default rendering options to use.
+ Here is the caller graph for this function:

◆ getDescription()

CollaborationListContent::getDescription ( )
Returns
string
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHumanEditableList()

CollaborationListContent::getHumanEditableList ( )

Get the list of items in human editable form.

Returns
string
Todo
i18n-ize
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isValid()

CollaborationListContent::isValid ( )

Decode and validate the contents.

Returns
bool Whether the contents are valid
+ Here is the caller graph for this function:

◆ loadStyles()

static CollaborationListContent::loadStyles ( $content,
array $attributes,
Parser $parser )
static

Hack to allow styles to be loaded from plain transclusion.

We don't have access to a parser object in getWikitextForTransclusion(). So instead we put <collaborationkitloadliststyles> on the page, which calls this.

Parameters
string$contentInput to parser hook
array$attributes
Parser$parser
Returns
string Empty string

◆ onArticleViewHeader()

static CollaborationListContent::onArticleViewHeader ( Article $article)
static

Hook used to determine if current user should be given the edit interface for a page.

Todo
Not clear if this is the best hook to use. onBeforePageDisplay doesn't have easy access to oldid
Parameters
Article$article

◆ onBeforePageDisplay()

static CollaborationListContent::onBeforePageDisplay ( OutputPage $out,
$skin )
static

Hook to add timestamp for edit conflict detection.

Parameters
OutputPage$out
Skin$skin

◆ onCustomEditor()

static CollaborationListContent::onCustomEditor ( Page $page,
User $user )
static

Hook to use custom edit page for lists.

Parameters
Article | Page$page
User$user(Not used)
Returns
bool|null

◆ transcludeHook()

static CollaborationListContent::transcludeHook ( $parser,
$pageName = '',
$args )
static

Function to handle {{#trancludelist:Page name|options...}} calls.

Parameters
Parser$parser
string$pageName
string...$args
Returns
string|array HTML string or an array [ string, 'noparse' => false ]

The documentation for this class was generated from the following file: