0

Is it possible in Magento 2 to create a new cms block(using widget) with content of an existing block, and admin can change the images, links and text of new block????

Actually, I need a template(widget), and it should be called in different pages. For different pages, I need to change the template's images, text and links. For example, I have a cms block for showing these images on homepage

enter image description here

Now, I need the same block for some other page, but I need options to change images(using image uploader), texts and links... Any help will be appreciated... Thanks

asked Sep 13, 2016 at 9:49
4
  • Can you please explain/elaborate ? Commented Sep 13, 2016 at 9:55
  • @Arun, I have edited my question. Please check... Commented Sep 13, 2016 at 12:49
  • is the content dynamic or static ? Commented Sep 14, 2016 at 5:12
  • content is dynamic. Commented Sep 14, 2016 at 5:17

1 Answer 1

0

You can call a phtml template in you static block and write you logic in the template file

Create a block with content

{{block class="Magento\Framework\View\Element\Template" template="Magento_Theme::html/dynamic-images.phtml"}}

then create a template file dynamic-images.phtml under \app\design\frontend\<Vendor>\<Theme_Name>\Magento_Theme\templates\html

and write you dynamic code in dynamic-images.phtml.

don't forget to clear cache (php bin/magento cache:clean) every time you make changes to dynamic-images.phtml.

I hope you know how to create a widget.

answered Sep 14, 2016 at 5:23
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.