I have tried to upload image in block using wysiwyg editor.
1.click the Insert/Edit image
2.choose a image
3.save
but image not showing in preview.
for Custom Product text type Attribute: Inject Magento\Catalog\Helper\Output class in you Block Class.
use Magento\Catalog\Helper\Output as ProductAttribute;
class Planlist extends DataObject
{
/**
* @var ProductAttribute
*/
private $_productAttribute;
public function __construct(
...
ProductAttribute $productAttribute,
...
) {
...
$this->_productAttribute = $productAttribute;
...
}
/**
* Prepare product attribute html output
*
* @param ModelProduct $product
* @param string $attributeHtml
* @param string $attributeName
* @return string
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
public function getAdditionalData($product, $attributeHtml, $attributeName)
{
return $this->_productAttribute->productAttribute($product, $attributeHtml, $attributeName);
}
}
Call this Function where the need
$this->getAdditionalData($item,$item->getData('service_packages'),'service_packages'),