0

How can i find where this function is written <?= $block->getText() ?> what does it mean /* $block \Magento\Cms\Block\Widget\Block */ Is this file location or what.?

/* @var $block \Magento\Cms\Block\Widget\Block */

?>

 <div class="widget block block-static-block">  
  <?=  $block->getText() ?> 

  </div>*emphasized text*  

1 Answer 1

0

Open

vendor/magento/module-cms/Block/Widget/Block.php

protected function _beforeToHtml()
{
    parent::_beforeToHtml();
    $blockId = $this->getData('block_id');
    $blockHash = get_class($this) . $blockId;

    if (isset(self::$_widgetUsageMap[$blockHash])) {
        return $this;
    }
    self::$_widgetUsageMap[$blockHash] = true;

    $block = $this->getBlock();

    if ($block && $block->isActive()) {
        try {
            $storeId = $this->getData('store_id') ?? $this->_storeManager->getStore()->getId();
            $this->setText(
                $this->_filterProvider->getBlockFilter()->setStoreId($storeId)->filter($block->getContent())
            );
        } catch (NoSuchEntityException $e) {
        }
    }
    unset(self::$_widgetUsageMap[$blockHash]);
    return $this;
}

Check this method where set text value:

$this->setText(

this line.

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.