1

I have added a custom attribute to CMS Page in magento 2. Can anyone please guide me How can I Export the value of that attribute of each CMS page through Custom Module?

enter image description here

Thanks

3
  • Sorry, But I am asking for Magento 2. Aug 23, 2016 at 4:40
  • You can export table from database. Aug 23, 2016 at 9:03
  • Hi, I want to add a Export Entity in Magento 2 Export Options through Custom Module. Aug 23, 2016 at 9:06

1 Answer 1

0

In Magento 2.1, use the PageRepository:

class CustomBlock extends AbstractBlock
{
    protected $pageRepository;

    public function __construct(\Magento\Cms\Model\PageRepositoryInterface $pageRepository)
    {
        $this->pageRepository = $pageRepository;
    }

    public function getPageAttribute($attributeName, $pageId)
    {
        $page = $this->pageRepository->getById($pageId);

        return $page->getData($attributeName);
    }

}
1
  • Hi, Please check the picture in my edited question above. I want to add the separate entity for this task. Can you please help me? Aug 23, 2016 at 9:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.