Customized layout with PHP
PHP - using Blocks
If you are a developer and are used to code with entity collection, addAttributeToFilter, and addAttributeToSelect methods, this section is made for you.
You can easily integrate a list whether by using Blackbird\ContentManager\Block\ContentList
or extends Blackbird\ContentManager\Block\Content\Widget\ContentList block
or by using calling directly a Content collection Blackbird\ContentManager\Model\ResourceModel\Content\CollectionFactory.
$_objectManager = \Magento\Framework\App\ObjectManager::getInstance(); //instance of\Magento\Framework\App\ObjectManager$contentCollection = $_objectManager->create('Blackbird\ContentManager\Model\ResourceModel\Content\CollectionFactory');$collection = $contentCollection->create()->addContentTypeFilter('news')->addAttributeToFilter('status', 1)->addAttributeToSelect('title')->addAttributeToSelect('url_key')->addAttributeToSelect('image');
PHP - Directly into a .phtml theme file
You can call on content directly into a theme .phtml file using Blackbird\ContentManager\Model\ResourceModel\Content\CollectionFactory. This example uses news as the *identifier* and also uses ->setPageSize() & ->setCurPage() to limit the content.
$_objectManager = \Magento\Framework\App\ObjectManager::getInstance(); //instance of\Magento\Framework\App\ObjectManager$contentCollection = $_objectManager->create('Blackbird\ContentManager\Model\ResourceModel\Content\CollectionFactory'); $collection = $contentCollection->create()->addContentTypeFilter('news')->addAttributeToFilter('status', 1)->addAttributeToSelect('title')->addAttributeToSelect('url_key')->addAttributeToSelect('image');->setPageSize(2)->setCurPage(1)foreach ($collection as $_content){print_r($_content->getData()).'
';}
