How to get Base Url and Current Url Magento 2?

In Magento 2, You can get Base Url, Current Url, get Media URL, get static page URL and custom URL using Magento\Store\Model\StoreManagerInterface and Magento\Framework\UrlInterface Object.

Using StoreManager Object,
Create PHP file and Passed Dependency injection Magento\Store\Model\StoreManagerInterface, Continue reading “How to get Base Url and Current Url Magento 2?”

Get CMS Block Collection in Magento 2.

You can get all the CMS Static Blocks collection in Magento 2 by calling interface, Magento\Cms\Api\BlockRepositoryInterface.

Magento\Cms\Api\BlockRepositoryInterface used for getting CMS Static Blocks related data in Magento 2.

BlockRepositoryInterface is used when you need to fetch a collection of CMS Static blocks or get specific CMS static block data. You can get Specific Blocks data by Identifier using  Get Cms Blocks data by an identifier.

Continue reading “Get CMS Block Collection in Magento 2.”

Get CMS Block content by identifier in Magento 2.

You can get the CMS Static Blocks collection by an identifier in Magento 2 by calling the BlockRepositoryInterface interface.

Magento\Cms\Api\BlockRepositoryInterface is used for getting CMS Static Blocks in Magento 2.

BlockRepositoryInterface is used when you need to fetch a collection of CMS Static blocks or get specific CMS static block data.

Continue reading “Get CMS Block content by identifier in Magento 2.”