/**
  * For the table of contents on subpages of a CollaborationHub
  *
  * @param $out OutputPage
  * @param $text string the HTML text to be added
  * @return bool
  */
 public static function onOutputPageBeforeHTML(&$out, &$text)
 {
     $title = $out->getTitle();
     $parentHub = CollaborationHubContent::getParentHub($title);
     if ($parentHub && $out->getProperty('CollaborationHubSubpage') === 'in-progress' && count(Revision::newFromTitle($parentHub)->getContent()->getContent()) > 0) {
         $toc = new CollaborationHubTOC();
         $out->prependHtml($toc->renderSubpageToC($parentHub));
         $colour = Revision::newFromTitle($parentHub)->getContent()->getThemeColour();
         $text = Html::rawElement('div', ['class' => "mw-cklist-square-{$colour}"], $text);
         $out->addModuleStyles('ext.CollaborationKit.hubsubpage.styles');
         $out->addModules('ext.CollaborationKit.icons');
         $out->addModules('ext.CollaborationKit.blots');
         // Set this mostly just so we can make sure this entire thing hasn't already been done, because otherwise the ToC is added twice on edit for some reason
         $out->setProperty('CollaborationHubSubpage', true);
     }
     return true;
 }
 /**
  * Helper function for fillParserOutput: the table of contents
  * @param $title Title
  * @param $options ParserOptions
  * @return string
  */
 protected function getTableOfContents(Title $title, ParserOptions $options)
 {
     $toc = new CollaborationHubTOC();
     return $toc->renderTOC($this->content, $this->themeColour);
 }