public function __construct(Workflow $workflow, ManagerGroup $storage, $root)
 {
     parent::__construct($workflow, $storage);
     if ($root instanceof PostRevision) {
         $this->root = $root;
     } elseif ($root instanceof RootPostLoader) {
         $this->rootLoader = $root;
     } else {
         throw new InvalidInputException('Expected PostRevision or RootPostLoader, received: ' . is_object($root) ? get_class($root) : gettype($root), 'invalid-input');
     }
 }
 /**
  * @param IContextSource $context
  * @param string $action
  */
 public function init(IContextSource $context, $action)
 {
     parent::init($context, $action);
     if (!$this->workflow->isNew()) {
         /** @var PostSummaryQuery $query */
         $query = Container::get('query.postsummary');
         $this->formatterRow = $query->getResult($this->workflow->getId());
         if ($this->formatterRow) {
             $this->topicSummary = $this->formatterRow->revision;
         }
     }
 }
 public function init(IContextSource $context, $action)
 {
     parent::init($context, $action);
     // Basic initialisation done -- now, load data if applicable
     if ($this->workflow->isNew()) {
         return;
     }
     // Get the latest revision attached to this workflow
     $found = $this->storage->find('Header', array('rev_type_id' => $this->workflow->getId()), array('sort' => 'rev_id', 'order' => 'DESC', 'limit' => 1));
     if ($found) {
         $this->header = reset($found);
     }
 }
 /**
  * @param \OutputPage $out
  */
 public function setPageTitle(\OutputPage $out)
 {
     if ($this->action !== 'new-topic') {
         // Only new-topic should override page title, rest should default
         parent::setPageTitle($out);
         return;
     }
     $title = $this->workflow->getOwnerTitle();
     $message = $out->msg('flow-newtopic-first-heading', $title->getPrefixedText());
     $out->setPageTitle($message);
     $out->setHtmlTitle($message);
     $out->setSubtitle('< ' . \Linker::link($title));
 }