/** * {@inheritdoc} */ public function liveChildren($showAll = false, $onlyDeletedFromStage = false) { $staged = parent::liveChildren($showAll, $onlyDeletedFromStage); if (!$this->shouldFilter() && $this->isBlog() && !Permission::check('VIEW_DRAFT_CONTENT')) { $dataQuery = $staged->dataQuery()->innerJoin('BlogPost', '"BlogPost_Live"."ID" = "SiteTree_Live"."ID"')->where(sprintf('"PublishDate" < \'%s\'', Convert::raw2sql(SS_Datetime::now()))); $staged = $staged->setDataQuery($dataQuery); } return $staged; }
/** * Augments (@link Hierarchy::liveChildren()} * * @param $staged DataList * @param $showAll boolean **/ public function liveChildren($showAll = false, $onlyDeletedFromStage = false) { $staged = parent::liveChildren($showAll, $onlyDeletedFromStage); if (!$this->shouldFilter() && in_array(get_class($this->owner), ClassInfo::subClassesFor("Blog")) && !Permission::check("VIEW_DRAFT_CONTENT")) { // Filter publish posts $dataQuery = $staged->dataQuery()->innerJoin("BlogPost", '"BlogPost_Live"."ID" = "SiteTree"_"Live"."ID"')->where('"PublishDate" < \'' . Convert::raw2sql(SS_Datetime::now()) . '\''); $staged = $staged->setDataQuery($dataQuery); } return $staged; }