Composer Form Content in a Page List View?
Permalink 1 user found helpful
Is it possible to pull non-custom attribute composer form Content (as in content block text) into a Page List view template?
Thank you pvernaglia!
Finally got to this phase of the project, this worked a treat. I tweaked it a bit to truncate to the first paragraph, leaving this here for posterity... may help someone else.
// get description composer form block content $pBlocks = $page->GetBlocks(); foreach ($pBlocks as $pBlock){ if ($pBlock->btHandle == 'content') { $blockContent = $pBlock->getInstance(); $description = $blockContent->getContent(); // truncate it to the first paragraph, so we don't pickup unordered feature lists for listings view - td $description = substr($description,0, strpos($description, "</p>")+4); } }
Thank you for this snippet! Helped me save a lot of time.
[code]
$pBlocks = $page->GetBlocks();
foreach ($pBlocks as $pBlock){
if ($pBlock->btHandle == 'content') {
$blockContent = $pBlock->getInstance();
$description = $blockContent->getContent();
}
}