0

I want to get parameter's data from widget configuration in Block class.

https://devdocs.magento.com/guides/v2.3/ext-best-practices/tutorials/custom-widget.html

as we know from article, we can get parameter data in phtml file

$block->getData('title')

but how we can get the parameter data in Block class?

Im looking for something like this :

namespace OrangeCompany\Learning\Block\Widget;

use Magento\Framework\View\Element\Template;
use Magento\Widget\Block\BlockInterface;

class Test extends Template implements BlockInterface
{
    protected $_template = "widget/test.phtml";
    $title = $this->getData('title'); // Im looking for something like this
}

is it possible?

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.