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

Public Member Functions

 __construct ( $text)
 
 isValid ()
 Decode and validate the contents.
 
 decode ()
 Decode the JSON contents and populate protected variables.
 
 redirectProof (Title $title)
 Resolves the redirect of a Title if it is in fact a redirect.
 
 getIntroduction ()
 
 getFooter ()
 
 getImage ()
 
 getContent ()
 
 getDisplayName ()
 
 getThemeColour ()
 
 getHubClasses ()
 Helper function for fillParserOutput to get all the css classes for the page content.
 
 getMembersBlock (Title $title, ParserOptions $options, ParserOutput $output, $membersContent=null)
 Helper function for fillParserOutput.
 
 getParsedIntroduction (Title $title, ParserOptions $options)
 Helper function for fillParserOutput.
 
 getParsedAnnouncements (Title $title, ParserOptions $options, $announcementsText=null)
 Helper function for fillParserOutput.
 
 getParsedFooter (Title $title, ParserOptions $options)
 Helper function for fillParserOutput.
 
 getSecondFooter (Title $title)
 Get some extra buttons for another footer.
 
 getTableOfContents (Title $title, ParserOptions $options)
 Helper function for fillParserOutput: the table of contents.
 
 getParsedImage ( $image, $size=200)
 Generate an image based on what's in 'image', be it an icon or a file.
 
 convert ( $toModel, $lossy='')
 Converts content between wikitext and JSON.
 
 convertToHumanEditable ()
 Convert JSON to markup that's easier for humans.
 
 getHumanEditableContent ()
 Get the list of items in human editable form.
 

Static Public Member Functions

static getThemeColours ()
 10 preset colours; actual colour values are set in the extension.json and less modules
 
static getParentHub (Title $title)
 Find the parent hub, if any.
 
static escapeForHumanEditable ( $text)
 Escape characters used as separators in human editable mode.
 
static unescapeForHumanEditable ( $text)
 Removes escape characters inserted in human editable mode.
 
static convertFromHumanEditable ( $text)
 Convert from human editable form into a (php) array.
 
static onCustomEditor (Page $page, User $user)
 Hook to use custom edit page for lists.
 

Public Attributes

 $displaymode
 
 $errortext
 

Protected Member Functions

 makeHeader (Title $title, array $contentItem)
 Helper function for getParsedContent for making subpage section headers.
 
 makeActionButton ( $title, $message, $setOptions=[])
 Helper function for fillParserOutput for making various action links (editsection links, purge cache buttons, whatever)
 

Protected Attributes

 $displayName
 
 $image
 
 $introduction
 
 $content
 
 $footer
 
 $themeColour
 
 $decoded = false
 

Constructor & Destructor Documentation

◆ __construct()

CollaborationHubContent::__construct ( $text)
Parameters
string$text

Member Function Documentation

◆ convert()

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

Converts content between wikitext and JSON.

Parameters
string$toModel
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
+ Here is the call graph for this function:

◆ convertFromHumanEditable()

static CollaborationHubContent::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
+ Here is the caller graph for this function:

◆ convertToHumanEditable()

CollaborationHubContent::convertToHumanEditable ( )

Convert JSON to markup that's easier for humans.

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

◆ escapeForHumanEditable()

static CollaborationHubContent::escapeForHumanEditable ( $text)
static

Escape characters used as separators in human editable mode.

Parameters
string$text
Returns
string Escaped text
Exceptions
MWContentSerializationException
Todo
Unclear if this is best approach. Alternative might be to use 
 Or an obscure unicode character like ␊ (U+240A).
+ Here is the caller graph for this function:

◆ getContent()

CollaborationHubContent::getContent ( )
Returns
array
+ Here is the call graph for this function:

◆ getDisplayName()

CollaborationHubContent::getDisplayName ( )
Returns
string
+ Here is the call graph for this function:

◆ getFooter()

CollaborationHubContent::getFooter ( )
Returns
string
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHubClasses()

CollaborationHubContent::getHubClasses ( )

Helper function for fillParserOutput to get all the css classes for the page content.

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

◆ getHumanEditableContent()

CollaborationHubContent::getHumanEditableContent ( )

Get the list of items in human editable form.

Returns
string
Todo
Should this be i18n-ized?
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getImage()

CollaborationHubContent::getImage ( )
Returns
string
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getIntroduction()

CollaborationHubContent::getIntroduction ( )
Returns
string
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMembersBlock()

CollaborationHubContent::getMembersBlock ( Title $title,
ParserOptions $options,
ParserOutput $output,
$membersContent = null )

Helper function for fillParserOutput.

Parameters
Title$title
ParserOptions$options
ParserOutput$output
CollaborationListContent | null$membersContentMember list Content for testing purposes
Returns
string
+ Here is the call graph for this function:

◆ getParentHub()

static CollaborationHubContent::getParentHub ( Title $title)
static

Find the parent hub, if any.

Returns the first CollaborationHub Title found, even if more are higher up, or null if none

Parameters
Title$titleTitle to start looking from
Returns
Title|null Title of parent hub or null if none was found

◆ getParsedAnnouncements()

CollaborationHubContent::getParsedAnnouncements ( Title $title,
ParserOptions $options,
$announcementsText = null )

Helper function for fillParserOutput.

Parameters
Title$title
ParserOptions$options
string | null$announcementsTextForce-fed announcements HTML for testing purposes
Returns
string
+ Here is the call graph for this function:

◆ getParsedFooter()

CollaborationHubContent::getParsedFooter ( Title $title,
ParserOptions $options )

Helper function for fillParserOutput.

Parameters
Title$title
ParserOptions$options
Returns
string
+ Here is the call graph for this function:

◆ getParsedImage()

CollaborationHubContent::getParsedImage ( $image,
$size = 200 )

Generate an image based on what's in 'image', be it an icon or a file.

Parameters
string$imageFilename or icon name
int$sizeint for non-icon images
Returns
string HTML
+ Here is the call graph for this function:

◆ getParsedIntroduction()

CollaborationHubContent::getParsedIntroduction ( Title $title,
ParserOptions $options )

Helper function for fillParserOutput.

Parameters
Title$title
ParserOptions$options
Returns
string
+ Here is the call graph for this function:

◆ getSecondFooter()

CollaborationHubContent::getSecondFooter ( Title $title)

Get some extra buttons for another footer.

Parameters
Title$title
Returns
string
+ Here is the call graph for this function:

◆ getTableOfContents()

CollaborationHubContent::getTableOfContents ( Title $title,
ParserOptions $options )

Helper function for fillParserOutput: the table of contents.

Parameters
Title$title
ParserOptions$options
Returns
string

◆ getThemeColour()

CollaborationHubContent::getThemeColour ( )
Returns
string
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getThemeColours()

static CollaborationHubContent::getThemeColours ( )
static

10 preset colours; actual colour values are set in the extension.json and less modules

Returns
array
+ Here is the caller graph for this function:

◆ isValid()

CollaborationHubContent::isValid ( )

Decode and validate the contents.

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

◆ makeActionButton()

CollaborationHubContent::makeActionButton ( $title,
$message,
$setOptions = [] )
protected

Helper function for fillParserOutput for making various action links (editsection links, purge cache buttons, whatever)

Parameters
Title$titleTarget page
string$messageMessage to display
array$setOptionsof a bunch of options, mostly to forward to the OOUI button (see defaults below)
Returns
string either an OOUI\ButtonWidget effectively tostringed, or a ck:editsection marker which will get replaced with an OOUI\ButtonWidget later in CollaborationHubContentHandler::onParserOutputPostCacheTransform
+ Here is the caller graph for this function:

◆ makeHeader()

CollaborationHubContent::makeHeader ( Title $title,
array $contentItem )
protected

Helper function for getParsedContent for making subpage section headers.

Parameters
Title$title
array$contentItemData for the content item we're generating the header for
Returns
string html (NOTE THIS IS AN OPEN DIV)
+ Here is the call graph for this function:

◆ onCustomEditor()

static CollaborationHubContent::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

◆ redirectProof()

CollaborationHubContent::redirectProof ( Title $title)

Resolves the redirect of a Title if it is in fact a redirect.

Consistent with general MediaWiki behavior, this function does not resolve double redirects.

Parameters
Title$titleTitle which may or may not be a redirect
Returns
Title
+ Here is the caller graph for this function:

◆ unescapeForHumanEditable()

static CollaborationHubContent::unescapeForHumanEditable ( $text)
static

Removes escape characters inserted in human editable mode.

Parameters
string$text
Returns
string Unescaped text

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