# How to get config variables from custom cms-block on frontend

**URL:** <https://forum.shopware.com/t/how-to-get-config-variables-from-custom-cms-block-on-frontend/91122>\
**Category:** Shopware 6 (English)\
**Created:** [27. Oktober 2021 um 08:54 UTC](https://forum.shopware.com/t/how-to-get-config-variables-from-custom-cms-block-on-frontend/91122 "2021-10-27T08:54:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![yurii.k](https://avatars.discourse-cdn.com/v4/letter/y/90ced4/32.png) [@yurii.k](https://forum.shopware.com/u/yurii.k)\
**Post date:** [27. Oktober 2021 um 08:54 UTC](https://forum.shopware.com/t/how-to-get-config-variables-from-custom-cms-block-on-frontend/91122/1 "2021-10-27T08:54:26Z")

</div>

Hi! I create custom CMS-Element from this tutorial:  
[Add CMS Element](https://developer.shopware.com/docs/guides/plugins/plugins/content/cms/add-cms-element)  
I can set in config-input field some video ID from [dailymotion.com](http://dailymotion.com), it works nice.  
On frontend it renders from twig file - **/src/Resources/views/storefront/element/cms-element-dailymotion.html.twig** , it also works nice. I see, that in this twig file I get saved video-ID via **{{ element.config.dailyUrl.value }}** , perfect!  
But, for put this CMS Element to some Layout - I need drag-drop in Layout-editor some other CMS-Block from right and then I must replace it for my Dailymotion-element. Logically, it will be good to create some CMS-Block for Dailymotion, because I want see it in right side in Layout editor.

So, I have create new CMS-Block reading this tutorial:  
[Add custom CMS blocks](https://developer.shopware.com/docs/guides/plugins/apps/content/cms/add-custom-cms-blocks)  
I puted it in video-category of blocks.  
Now I see this block in right side of Layout-editor under video-category, I can drag-drop it to layout and configuring it with video-id. In admin side it still works nice, I see, how movie changes when I change video-id and I can save it - it works.  
If I use my new CMS-Block for Dailymotion - I must use other twig file on frontend: **/src/Resources/views/storefront/block/cms-block-dailymotion.html.twig**  
But in it I can’t get {{ element }} object, so, this way with CMS-Block does not work.  
When I try dump element object ({{ dump(element) }}) - I get **null**  
Ok, then I try {{ dum(block) }} - I see necessary vatiable deep in block.slots.elements[„ElementID“].config[„dailyUrl“][„value“]  
But it is bad way, because ElementID changes from element-to-element.

So, my question is - how can I get my config variable on frontend in twig-file, when I use CMS-Block instead CMS-Element?

---

<div class="post-metadata">

**Author:** ![jonas.joachim](https://avatars.discourse-cdn.com/v4/letter/j/e95f7d/32.png) [@jonas.joachim](https://forum.shopware.com/u/jonas.joachim)\
**Post date:** [28. Oktober 2021 um 10:38 UTC](https://forum.shopware.com/t/how-to-get-config-variables-from-custom-cms-block-on-frontend/91122/2 "2021-10-28T10:38:25Z")

</div>

My question [here](https://forum.shopware.com/t/accessing-custom-cms-blocks-content-in-twig/90948/4) is somewhat related but as you can see this whole custom CMS block/element topic is also still WIP for me.  
In your case the solution is probably to take the approach of the core template files and set `{% set element = block.slots.getSlot('slot_name') %}` first. Thus, this `block`-object is not well documented and still a mistery to me.

---

<div class="post-metadata">

**Author:** ![yurii.k](https://avatars.discourse-cdn.com/v4/letter/y/90ced4/32.png) [@yurii.k](https://forum.shopware.com/u/yurii.k)\
**Post date:** [28. Oktober 2021 um 12:49 UTC](https://forum.shopware.com/t/how-to-get-config-variables-from-custom-cms-block-on-frontend/91122/3 "2021-10-28T12:49:18Z")

</div>

Nice, thanks a lot, it helps me. Now I can use my config variables on frontend!
