Get page content for Page List, no longer working?

Hi, for years i’ve used this code to get the teaser content on a page list fro the page content block if there is no page description, however having updated to v9, I now get the error:

Cannot access protected property Concrete\Core\Block\Block::$btHandle


            foreach ($pages as $page) { ...

$blocks = $page->GetBlocks();
              foreach ($blocks as $block){
                    if ($block->btHandle == 'content') {
                        $blockContent = $block->getInstance();
                        $description = $blockContent->getContent();
                        // truncate it to the first paragraph, so we don't pickup unordered feature lists for listings view - td
                        $description = $controller->truncateSummaries ? $th->wordSafeShortText($description, $controller->truncateChars) : $description;
                      break;
                    }
              }

... }

Try $block->getBlockTypeHandle()

2 Likes

Thank you :slight_smile: That’s just what I needed!