With the module "config pages" I’ve set some variables global to render in templates. In mytheme.theme I’ve added a function:
function mytheme_preprocess(array &$variables, $hook) { $myConfigPage = Drupalconfig_pagesEntityConfigPages::config('config_name'); $variables['my_settings'] = $myConfigPage->toArray(); }
In the config_pages I’ve created a link field. I would like to render them, but I get below output. How can I render the link in Twig?
^ array:3 [▼ 0 => array:3 [▼ "uri" => "entity:node/186" "title" => "Title 3" "options" => [] ] 1 => array:3 [▼ "uri" => "entity:node/189" "title" => "Title 1" "options" => [] ] 2 => array:3 [▼ "uri" => "entity:node/195" "title" => "Title 2" "options" => [] ] ]
Twig:
{{ dd(my_settings.field_links) }} {% for link in my_settings.field_links %} <div class="field__item"> {{ dd(link) }} {{ link.uri|render }} {{ link.title }} </div> {% endfor %}
None of above are working.