Skip to content

Commit

Permalink
Show unpublished elements within preview mode
Browse files Browse the repository at this point in the history
  • Loading branch information
zoglo committed Aug 3, 2023
1 parent 185fe7a commit ce5c246
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 17 deletions.
12 changes: 3 additions & 9 deletions src/EventListener/GeneratePageListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,26 +31,20 @@
*/
class GeneratePageListener
{
/**
* @var ContaoFramework
*/
private $framework;

public function __construct(ContaoFramework $framework)
public function __construct(private ContaoFramework $framework)
{
$this->framework = $framework;
}

public function __invoke(PageModel $pageModel, LayoutModel $layoutModel, PageRegular $pageRegular): void
{
//$this->framework->initialize();
$this->framework->initialize();

if ($pageModel->disableGlossary)
{
return;
}

// Get Rootpage Settings
// Get Root page Settings
$objRootPage = PageModel::findByPk($pageModel->rootId);

if (null === $objRootPage || !$objRootPage->activateGlossary)
Expand Down
12 changes: 4 additions & 8 deletions src/Model/GlossaryItemModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,12 +257,10 @@ public static function findPublishedByPids($arrPids, array $arrOptions = [])
$t = static::$strTable;
$arrColumns = ["$t.pid IN(".implode(',', array_map('\intval', $arrPids)).')'];

// Never return unpublished elements in the back end
// ToDo: Check later
/*if (!BE_USER_LOGGED_IN || TL_MODE === 'BE')
if (!static::isPreviewMode($arrOptions))
{
$arrColumns[] = "$t.published='1'";
}*/
}

if (!isset($arrOptions['order']))
{
Expand Down Expand Up @@ -293,12 +291,10 @@ public static function findPublishedByLetterAndPids($strLetter, $arrPids, array
$arrColumns[] = "$t.pid IN(".implode(',', array_map('\intval', $arrPids)).')';
$arrValues = [$strLetter];

// Never return unpublished elements in the back end
// ToDo: Check later
/*if (!BE_USER_LOGGED_IN || TL_MODE === 'BE')
if (!static::isPreviewMode($arrOptions))
{
$arrColumns[] = "$t.published='1'";
}*/
}

if (!isset($arrOptions['order']))
{
Expand Down

0 comments on commit ce5c246

Please sign in to comment.