{"id":11576,"date":"2016-08-22T18:20:17","date_gmt":"2016-08-22T15:20:17","guid":{"rendered":"http:\/\/blog.belvg.com\/?p=11576"},"modified":"2025-06-27T07:41:09","modified_gmt":"2025-06-27T05:41:09","slug":"custom-variables-and-filters-in-static-blocks-in-magento-2","status":"publish","type":"post","link":"https:\/\/belvg.com\/blog\/custom-variables-and-filters-in-static-blocks-in-magento-2.html","title":{"rendered":"Custom Variables and Filters in Static Blocks in Magento 2"},"content":{"rendered":"\n<p>In the following article I&rsquo;d like to share my experience of creating custom variables and filters in static blocks, including further configuration.<!--more--><\/p>\n<p>This topic seems rather interesting to me, and I think it would be very significant for developers. I was confused when I faced a similar task and spent a lot of time trying to find solution, but finally found it in Magento 2 code.<\/p>\n<p><strong>So let&rsquo;s begin:<\/strong><\/p>\n<p>At first we have to create module, for example <em>Belvg_CustomStaticBlockFilters<\/em>. It will consist&nbsp; of the following files:<\/p>\n<ul>\n<li><strong>Block\/Block.php<\/strong> &mdash; our modified block, that will be used on CMS pages or anywhere else.<\/li>\n<li><strong>etc\/module.xml<\/strong> &mdash; well-known module file.<\/li>\n<li><strong>Helper\/Data.php<\/strong> &mdash; additional code (if required)<\/li>\n<li><strong>Model\/Template\/Filter.php<\/strong> &mdash; our magic filter :-)<\/li>\n<\/ul>\n<div class=\"module_in_content_container\"><a href=\"https:\/\/belvg.com\/magento-custom-development\" class=\"link_to_module\" target=\"_blank\" rel=\"noopener\"><\/a><div class=\"module_content\"><img src=\"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2019\/01\/magento-custom-development.png\" width=\"120\" height=\"120\" alt=\"magento custom development\" class=\"module_image\" title=\"Custom Variables and Filters in Static Blocks in Magento 2\"><div class=\"module_content_part\"><h3 class=\"title\">Magento Custom Development<\/h3><p class=\"module_content_text\">Take your online store to the next level with BelVG Magento Custom Development<\/p><a href=\"https:\/\/belvg.com\/magento-custom-development\" class=\"link_2_to_module\" target=\"_blank\" style=\"display:inline-block\" rel=\"noopener\"><span class=\"read-more\">Visit the page<\/span><\/a><\/div><\/div><\/div>\n<p><strong>Block.php code example:<\/strong><\/p>\n<pre class=\"lang:php decode:true \">namespace BelVG\\CustomStaticBlockFilters\\Block;\r\n\r\nuse Magento\\Framework\\App\\ObjectManager;\r\n\r\n\/**\r\n * Cms block content block\r\n *\/\r\nclass Block extends \\Magento\\Cms\\Block\\Block\r\n{\r\n\r\n    protected function getDefaultData()\r\n    {\r\n        \/\/ Your Data Logic\r\n        return $this-&gt;getData();\r\n    }\r\n\r\n    \/**\r\n     * Prepare Content HTML\r\n     * @return string\r\n     *\/\r\n    protected function _toHtml()\r\n    {\r\n        $blockId = $this-&gt;getBlockId();\r\n        $html = '';\r\n        if ($blockId) {\r\n            $storeId = $this-&gt;_storeManager-&gt;getStore()-&gt;getId();\r\n            $block = $this-&gt;_blockFactory-&gt;create();\r\n            $block-&gt;setStoreId($storeId)-&gt;load($blockId);\r\n            if ($block-&gt;isActive()) {\r\n                if (!isset($this-&gt;_filter)) {\r\n                    $this-&gt;_filter = ObjectManager::getInstance()-&gt;get('\\BelVG\\CustomStaticBlockFilters\\Model\\Template\\Filter');\r\n                }\r\n                \r\n                $this-&gt;_filter-&gt;initDefaultFilters();\r\n                $this-&gt;_filter-&gt;setVariables($this-&gt;getDefaultData());\r\n                $html = $this-&gt;_filter-&gt;setStoreId($storeId)-&gt;filter($block-&gt;getContent());\r\n            }\r\n        }\r\n        return $html;\r\n    }\r\n}<\/pre>\n<p><strong>Filters.php code example:<\/strong><\/p>\n<pre class=\"lang:php decode:true \">namespace BelVG\\CustomStaticBlockFilters\\Model\\Template;\r\n\r\nuse \\Magento\\Framework\\App\\ObjectManager;\r\n\r\nclass Filter extends \\Magento\\Email\\Model\\Template\\Filter\r\n{\r\n    \/\/ Basic initialization of preset filters \r\n    public function initDefaultFilters()\r\n    {\r\n        $this-&gt;_modifiers = [\r\n            'value' =&gt; [$this, 'value'],\r\n            'dateFormat' =&gt; [$this, 'dateFormat'],\r\n            'priceFormat' =&gt; [$this, 'priceFormat']\r\n        ];\r\n        return $this;\r\n    }\r\n\r\n    \/\/ Flexible abilities for filter usage, and ability of rapid adding\r\n    public function addModifier($name, $data = ['this', 'value'])\r\n    {\r\n        if ($data[0] == 'this') {\r\n            $data[0] = $this;\r\n        }\r\n\r\n        $this-&gt;_modifiers[$name] = $data;\r\n    }\r\n\r\n    public function value($value)\r\n    {\r\n        return $value;\r\n    }\r\n\r\n    \/\/ Random date format\r\n    public function dateFormat($value, $format)\r\n    {\r\n        $time = strtotime($value);\r\n        return date($format, $time);\r\n    }\r\n\r\n    \/\/ Price format\r\n    public function priceFormat($value, $clean = true)\r\n    {\r\n        $priceFilter = ObjectManager::getInstance()\r\n            -&gt;create('\\Magento\\Framework\\Pricing\\PriceCurrencyInterface');\r\n        $value = $priceFilter-&gt;format($value, false);\r\n        if ($clean) {\r\n            $value = str_replace($priceFilter-&gt;getCurrencySymbol(), '', $value);\r\n        }\r\n        \r\n        return $value;\r\n    }\r\n\r\n}<\/pre>\n<p>Right after Class and Function description let&rsquo;s start their implementation:<\/p>\n<p><strong>Example of use in layout.xml:<\/strong><\/p>\n<pre class=\"lang:xml decode:true \">&lt;block class=\"BelVG\\CustomStaticBlockFilters\\Block\\Block\" name=\"CustomBlock\"&gt;\r\n    &lt;arguments&gt;\r\n        &lt;argument name=\"block_id\" xsi:type=\"string\"&gt;custom_block&lt;\/argument&gt;\r\n    &lt;\/arguments&gt;\r\n&lt;\/block&gt;<\/pre>\n<p><strong>Example of use in code:<\/strong><\/p>\n<pre class=\"lang:php decode:true \">protected function getBlock($blockId)\r\n{\r\n    $objectManager = ObjectManager::getInstance();\r\n    $block = $objectManager-&gt;get('\\BelVG\\CustomStaticBlockFilters\\Block\\Block');\r\n    $block-&gt;setBlockId('custom_block');\r\n    return $block-&gt;toHtml();\r\n}<\/pre>\n<p><strong>dataFormat filter example of use:<\/strong><\/p>\n<pre class=\"lang:html decode:true \">{{var invoice_created_at|dateFormat:d\/m-y}}<\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"lazy aligncenter wp-image-11577 size-belvg-post-content\" src=\"https:\/\/belvg.com\/wp-content\/uploads\/2019\/06\/pixel.png\" data-src=\"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2016\/08\/Custom-Variables-and-Filters-in-Static-Blocks-in-Magento-2-850x330.png\" alt=\"Custom Variables and Filters in Static Blocks in Magento 2\" width=\"850\" height=\"330\" title=\"Custom Variables and Filters in Static Blocks in Magento 2\"><\/p>\n<p>Eventually we end up with the following page.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"lazy aligncenter wp-image-11578 size-full\" src=\"https:\/\/belvg.com\/wp-content\/uploads\/2019\/06\/pixel.png\" data-src=\"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2016\/08\/Custom-Variables-and-Filters-in-Static-Blocks-in-Magento-1.png\" alt=\"Custom Variables and Filters in Static Blocks in Magento 1\" width=\"766\" height=\"352\" title=\"Custom Variables and Filters in Static Blocks in Magento 2\"><\/p>\n<p>I do really hope this article will help you with module development in future. Have a nice day, friends!<\/p>\n<div class=\"module_in_content_container\"><a href=\"https:\/\/belvg.com\/magento-support\" class=\"link_to_module\" target=\"_blank\" rel=\"noopener\"><\/a><div class=\"module_content\"><img src=\"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2017\/07\/Magento_support.png\" width=\"120\" height=\"120\" alt=\"Magento support\" class=\"module_image\" title=\"Custom Variables and Filters in Static Blocks in Magento 2\"><div class=\"module_content_part\"><h3 class=\"title\">Magento Support<\/h3><p class=\"module_content_text\">Take your online store to the next level with BelVG Magento Support<\/p><a href=\"https:\/\/belvg.com\/magento-support\" class=\"link_2_to_module\" target=\"_blank\" style=\"display:inline-block\" rel=\"noopener\"><span class=\"read-more\">Visit the page<\/span><\/a><\/div><\/div><\/div>\n\n","protected":false},"excerpt":{"rendered":"In the following article I&#8217;d like to share my experience of creating custom variables and &#8230;","protected":false},"author":50,"featured_media":11579,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"image","meta":{"_acf_changed":false,"footnotes":""},"categories":[14,389,524,526],"tags":[],"class_list":["post-11576","post","type-post","status-publish","format-image","has-post-thumbnail","hentry","category-magento","category-magento2-development","category-magento-speed-optimization","category-magento-theme","post_format-post-format-image"],"acf":[],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.4 - aioseo.com -->\n\t<meta name=\"description\" content=\"In the following article I\u2019d like to share my experience of creating custom variables and filters in static blocks, including further configuration.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Oleg Semenov\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/belvg.com\/blog\/custom-variables-and-filters-in-static-blocks-in-magento-2.html\" \/>\n\t\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.4\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/custom-variables-and-filters-in-static-blocks-in-magento-2.html#article\",\"name\":\"Custom Variables & Filters in Static Blocks in Magento 2 | BelVG Blog\",\"headline\":\"Custom Variables and Filters in Static Blocks in Magento 2\",\"author\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/author\\\/oleg-semenov#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/#organization\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/belvg.com\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/08\\\/Magento-2-User-Parameters-and-Static-Block-Filters1.jpg\",\"width\":700,\"height\":190,\"caption\":\"Magento 2 User Parameters and Static Block Filters1\"},\"datePublished\":\"2016-08-22T18:20:17+02:00\",\"dateModified\":\"2025-06-27T07:41:09+02:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/custom-variables-and-filters-in-static-blocks-in-magento-2.html#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/custom-variables-and-filters-in-static-blocks-in-magento-2.html#webpage\"},\"articleSection\":\"Magento, Magento 2 Development, Magento Speed Optimization, Magento Theme, Image\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/custom-variables-and-filters-in-static-blocks-in-magento-2.html#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/belvg.com\\\/blog\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/category\\\/magento#listItem\",\"name\":\"Magento\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/category\\\/magento#listItem\",\"position\":2,\"name\":\"Magento\",\"item\":\"https:\\\/\\\/belvg.com\\\/blog\\\/category\\\/magento\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/custom-variables-and-filters-in-static-blocks-in-magento-2.html#listItem\",\"name\":\"Custom Variables and Filters in Static Blocks in Magento 2\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/custom-variables-and-filters-in-static-blocks-in-magento-2.html#listItem\",\"position\":3,\"name\":\"Custom Variables and Filters in Static Blocks in Magento 2\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/category\\\/magento#listItem\",\"name\":\"Magento\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/#organization\",\"name\":\"BelVG Blog\",\"description\":\"Magento and Prestashop articles\",\"url\":\"https:\\\/\\\/belvg.com\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/author\\\/oleg-semenov#author\",\"url\":\"https:\\\/\\\/belvg.com\\\/blog\\\/author\\\/oleg-semenov\",\"name\":\"Oleg Semenov\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/custom-variables-and-filters-in-static-blocks-in-magento-2.html#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/316f0b410659190b56484ecdb7a98dce16a901ebe753c233c0f407ba96e81b1a?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Oleg Semenov\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/custom-variables-and-filters-in-static-blocks-in-magento-2.html#webpage\",\"url\":\"https:\\\/\\\/belvg.com\\\/blog\\\/custom-variables-and-filters-in-static-blocks-in-magento-2.html\",\"name\":\"Custom Variables & Filters in Static Blocks in Magento 2 | BelVG Blog\",\"description\":\"In the following article I\\u2019d like to share my experience of creating custom variables and filters in static blocks, including further configuration.\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/custom-variables-and-filters-in-static-blocks-in-magento-2.html#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/author\\\/oleg-semenov#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/author\\\/oleg-semenov#author\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/belvg.com\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/08\\\/Magento-2-User-Parameters-and-Static-Block-Filters1.jpg\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/custom-variables-and-filters-in-static-blocks-in-magento-2.html\\\/#mainImage\",\"width\":700,\"height\":190,\"caption\":\"Magento 2 User Parameters and Static Block Filters1\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/custom-variables-and-filters-in-static-blocks-in-magento-2.html#mainImage\"},\"datePublished\":\"2016-08-22T18:20:17+02:00\",\"dateModified\":\"2025-06-27T07:41:09+02:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/belvg.com\\\/blog\\\/\",\"name\":\"BelVG Blog\",\"description\":\"Magento and Prestashop articles\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Custom Variables & Filters in Static Blocks in Magento 2 | BelVG Blog","description":"In the following article I\u2019d like to share my experience of creating custom variables and filters in static blocks, including further configuration.","canonical_url":"https:\/\/belvg.com\/blog\/custom-variables-and-filters-in-static-blocks-in-magento-2.html","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/belvg.com\/blog\/custom-variables-and-filters-in-static-blocks-in-magento-2.html#article","name":"Custom Variables & Filters in Static Blocks in Magento 2 | BelVG Blog","headline":"Custom Variables and Filters in Static Blocks in Magento 2","author":{"@id":"https:\/\/belvg.com\/blog\/author\/oleg-semenov#author"},"publisher":{"@id":"https:\/\/belvg.com\/blog\/#organization"},"image":{"@type":"ImageObject","url":"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2016\/08\/Magento-2-User-Parameters-and-Static-Block-Filters1.jpg","width":700,"height":190,"caption":"Magento 2 User Parameters and Static Block Filters1"},"datePublished":"2016-08-22T18:20:17+02:00","dateModified":"2025-06-27T07:41:09+02:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/belvg.com\/blog\/custom-variables-and-filters-in-static-blocks-in-magento-2.html#webpage"},"isPartOf":{"@id":"https:\/\/belvg.com\/blog\/custom-variables-and-filters-in-static-blocks-in-magento-2.html#webpage"},"articleSection":"Magento, Magento 2 Development, Magento Speed Optimization, Magento Theme, Image"},{"@type":"BreadcrumbList","@id":"https:\/\/belvg.com\/blog\/custom-variables-and-filters-in-static-blocks-in-magento-2.html#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/belvg.com\/blog\/#listItem","position":1,"name":"Home","item":"https:\/\/belvg.com\/blog\/","nextItem":{"@type":"ListItem","@id":"https:\/\/belvg.com\/blog\/category\/magento#listItem","name":"Magento"}},{"@type":"ListItem","@id":"https:\/\/belvg.com\/blog\/category\/magento#listItem","position":2,"name":"Magento","item":"https:\/\/belvg.com\/blog\/category\/magento","nextItem":{"@type":"ListItem","@id":"https:\/\/belvg.com\/blog\/custom-variables-and-filters-in-static-blocks-in-magento-2.html#listItem","name":"Custom Variables and Filters in Static Blocks in Magento 2"},"previousItem":{"@type":"ListItem","@id":"https:\/\/belvg.com\/blog\/#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/belvg.com\/blog\/custom-variables-and-filters-in-static-blocks-in-magento-2.html#listItem","position":3,"name":"Custom Variables and Filters in Static Blocks in Magento 2","previousItem":{"@type":"ListItem","@id":"https:\/\/belvg.com\/blog\/category\/magento#listItem","name":"Magento"}}]},{"@type":"Organization","@id":"https:\/\/belvg.com\/blog\/#organization","name":"BelVG Blog","description":"Magento and Prestashop articles","url":"https:\/\/belvg.com\/blog\/"},{"@type":"Person","@id":"https:\/\/belvg.com\/blog\/author\/oleg-semenov#author","url":"https:\/\/belvg.com\/blog\/author\/oleg-semenov","name":"Oleg Semenov","image":{"@type":"ImageObject","@id":"https:\/\/belvg.com\/blog\/custom-variables-and-filters-in-static-blocks-in-magento-2.html#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/316f0b410659190b56484ecdb7a98dce16a901ebe753c233c0f407ba96e81b1a?s=96&d=mm&r=g","width":96,"height":96,"caption":"Oleg Semenov"}},{"@type":"WebPage","@id":"https:\/\/belvg.com\/blog\/custom-variables-and-filters-in-static-blocks-in-magento-2.html#webpage","url":"https:\/\/belvg.com\/blog\/custom-variables-and-filters-in-static-blocks-in-magento-2.html","name":"Custom Variables & Filters in Static Blocks in Magento 2 | BelVG Blog","description":"In the following article I\u2019d like to share my experience of creating custom variables and filters in static blocks, including further configuration.","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/belvg.com\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/belvg.com\/blog\/custom-variables-and-filters-in-static-blocks-in-magento-2.html#breadcrumblist"},"author":{"@id":"https:\/\/belvg.com\/blog\/author\/oleg-semenov#author"},"creator":{"@id":"https:\/\/belvg.com\/blog\/author\/oleg-semenov#author"},"image":{"@type":"ImageObject","url":"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2016\/08\/Magento-2-User-Parameters-and-Static-Block-Filters1.jpg","@id":"https:\/\/belvg.com\/blog\/custom-variables-and-filters-in-static-blocks-in-magento-2.html\/#mainImage","width":700,"height":190,"caption":"Magento 2 User Parameters and Static Block Filters1"},"primaryImageOfPage":{"@id":"https:\/\/belvg.com\/blog\/custom-variables-and-filters-in-static-blocks-in-magento-2.html#mainImage"},"datePublished":"2016-08-22T18:20:17+02:00","dateModified":"2025-06-27T07:41:09+02:00"},{"@type":"WebSite","@id":"https:\/\/belvg.com\/blog\/#website","url":"https:\/\/belvg.com\/blog\/","name":"BelVG Blog","description":"Magento and Prestashop articles","inLanguage":"en-US","publisher":{"@id":"https:\/\/belvg.com\/blog\/#organization"}}]}},"aioseo_meta_data":{"post_id":"11576","title":"Custom Variables &amp; Filters in Static Blocks in Magento 2 | #site_title","description":"In the following article I\u2019d like to share my experience of creating custom variables and filters in static blocks, including further configuration.","keywords":null,"keyphrases":null,"focus_keyword":null,"additional_keywords":null,"truseo_locale":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_custom_url":null,"og_image_custom_fields":null,"og_image_url":null,"og_image_width":null,"og_image_height":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_image_url":null,"twitter_title":null,"twitter_description":null,"schema_type":"default","schema_type_options":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"limit_modified_date":false,"ai":null,"breadcrumb_settings":null,"seo_analyzer_scan_date":null,"created":"2026-11-03 18:37:28","updated":"2026-11-03 18:37:28"},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/belvg.com\/blog\/\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/belvg.com\/blog\/category\/magento\" title=\"Magento\">Magento<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tCustom Variables and Filters in Static Blocks in Magento 2\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/belvg.com\/blog\/"},{"label":"Magento","link":"https:\/\/belvg.com\/blog\/category\/magento"},{"label":"Custom Variables and Filters in Static Blocks in Magento 2","link":"https:\/\/belvg.com\/blog\/custom-variables-and-filters-in-static-blocks-in-magento-2.html"}],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/posts\/11576","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/users\/50"}],"replies":[{"embeddable":true,"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/comments?post=11576"}],"version-history":[{"count":1,"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/posts\/11576\/revisions"}],"predecessor-version":[{"id":29639,"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/posts\/11576\/revisions\/29639"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/media\/11579"}],"wp:attachment":[{"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/media?parent=11576"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/categories?post=11576"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/tags?post=11576"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}