2 Comments

Magento 2 wysiwyg editor filter image

Magento 2: How to Set controller, module, action name? [duplicate]
Install of Magento2 fails [ERROR] exception 'Exception' with message 'Warning: mkdir(): File ex

I have custom module field code is bellow for wysiwyg field:-

 $wysiwygConfig = $this->_wysiwygConfig->getConfig(['tab_id' => $this->getTabId()]);
    $fieldset->addField(
                'news_content',
                'editor',
                [
                    'name' => 'news_content',
                    'label' => __('Long Description'),
                    'title' => __('Long Description'),
                    'style' => 'height:11em',
                    'required' => true,
                    'disabled' => $isElementDisabled,
                    'config' => $wysiwygConfig
                ]
            );

when i upload image in this field with content it only shows content and image is not come with proper tag as bellow:-

<p><img src="{{media url="wysiwyg/24.png"}}" alt="" /></p>
<p>test</p>

so there is a question that content filter we used in 1.9.X.X is not in magento 2.0.2.

how can i get image and description from wysiwyg editor with default filter to display image with content.

Related Posts

  • Change color of a label in a Magento form (2)
    I have a simple question, I know how to change an the color of an field in a magento form but my problem is i didn't know how to change the color of the label associate to it. here is an image : and here is my code : $fieldset->addField('modeleChoix', 'select', array( […]
  • Change type columns on Adminhtml Magento 2 (0)
    I've got a table for my own module, and i want to change the type of the column that i added. My render looks like: protected function _prepareToRender() { $this->addColumn('code', ['label' => __('Code'), 'style' => 'width:120px']); […]
  • Adding wysiwyg editor to Magento 2 product attribute options page (0)
    I have managed to add a custom description field for product attribute options. Now I need to add WYSIWYG editor for the same. My custom module override the default templates for this vendor/magento/module-catalog/view/adminhtml/templates/catalog/product/attribute/options.phtml and […]
  • How to add a datepicker for a custom field from system configuration (1)
    I follower this tutorial. You can add easily fields as input text or dropdown, but in my case I want to add the magento datepicker. I have this function : public function _prepareToRender() { $this->addColumn('holiday_name', array( 'label' => […]
  • How to add a datepicker for a custom field from system configuration (1)
    I follower this tutorial. You can add easily fields as input text or dropdown, but in my case I want to add the magento datepicker. I have this function : public function _prepareToRender() { $this->addColumn('holiday_name', array( 'label' => […]
  • Setting width for dropdown in magento2 system configuration (1)
    I have created a custom configuration same like MagentoBraintreeBlockAdminhtmlFormFieldCountrycreditcard.php with some fields like $this->addColumn( 'field', ['label' => __('Field'), 'renderer' => $this->_getAttributesRenderer(),'style' => […]
  • Custom fields for customer in admin html problem (0)
    I need to add a custom field for customer (only on backend), I've created a module. It is working fine when I add/edit customer from 'Customers' menu. But I need this option enabled when I create order from new order option (Sales->Orders->Create new order->Create new customer). I […]
  • magento 2: How add time to datepicker in backend (1)
    I'am using magento 2.0.5 and I want to add date field with time which saves date as well as time in database for entity. I had tried this code to add new field in my module. $fieldset->addField('enddate', 'date', array( 'name' => 'enddate', 'label' => […]
  • Magento 2 add text and move attribute using xml (0)
    I want to add label to product long description for that I've did following <referenceBlock name="product.info.description"> <arguments> <argument name="data" xsi:type="array"> <item name="text" […]
  • Magento 2 add text and move attribute using xml (0)
    I want to add label to product long description for that I've did following <referenceBlock name="product.info.description"> <arguments> <argument name="data" xsi:type="array"> <item name="text" […]
Magento 2: How to Set controller, module, action name? [duplicate]
Install of Magento2 fails [ERROR] exception 'Exception' with message 'Warning: mkdir(): File ex

2 Comments on this article

  • User November 12, 2016

    Use below code:

    $objectManager = MagentoFrameworkAppObjectManager::getInstance();
    
    $objectManager->get('MagentoCmsModelTemplateFilterProvider')->getBlockFilter()->filter($item->getContent());
    

    In above code $item->getContent() is your editor content

    Reply

  • User November 12, 2016

    Use this code:

    $objectManager = MagentoFrameworkAppObjectManager::getInstance();
    $product = $objectManager->get('MagentoFrameworkFilterTemplate')->getTemplateProcessor()->filter($attributeHtml);
    

    Where $attributeHtml should be the content of editor.

    Reply

Add a comment

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax