diff --git a/src/Resources/contao/elements/ContentBlockElement.php b/src/Resources/contao/elements/ContentBlockElement.php index 25a4a5a..14f409b 100644 --- a/src/Resources/contao/elements/ContentBlockElement.php +++ b/src/Resources/contao/elements/ContentBlockElement.php @@ -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) { @@ -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; } diff --git a/src/Resources/contao/models/ContentPatternModel.php b/src/Resources/contao/models/ContentPatternModel.php index 1363066..749e7aa 100644 --- a/src/Resources/contao/models/ContentPatternModel.php +++ b/src/Resources/contao/models/ContentPatternModel.php @@ -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 );