Skip to content

Commit

Permalink
Change to use ContentPatternModel::findPublishedByPid for selecting o…
Browse files Browse the repository at this point in the history
…nly published with database query
  • Loading branch information
Arne Stappen committed Oct 6, 2016
1 parent 0cd6456 commit 69798ad
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions src/Resources/contao/elements/ContentBlockElement.php
Expand Up @@ -138,9 +138,8 @@ public function generate()
*/
protected function compile()
{
// get related pattern model collection
$colPattern = $this->objBlock->getRelated('id', array('order'=>'sorting ASC'));

// get the pattern model collection
$colPattern = \ContentPatternModel::findPublishedByPid($this->objBlock->id);

if ($colPattern === null)
{
Expand All @@ -150,7 +149,7 @@ protected function compile()
foreach($colPattern as $objPattern)
{
// don´t show the invisible or system pattern
if ($objPattern->invisible || in_array($objPattern->type, $GLOBALS['TL_SYS_PATTERN']))
if (in_array($objPattern->type, $GLOBALS['TL_SYS_PATTERN']))
{
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/contao/models/ContentPatternModel.php
Expand Up @@ -60,7 +60,7 @@ public static function findPublishedByPid($varPid, array $arrOptions=array())
(
'column' => array("$t.pid=?", "$t.invisible=?"),
'value' => array($varPid, ''),
'order' => "$t.rid ASC",
'order' => "$t.sorting ASC",
),
$arrOptions
);
Expand Down

0 comments on commit 69798ad

Please sign in to comment.