I'm extending my map-marker-leaflet plugin.
When style is set explicitly, eg., [map-marker-leaflet style=outdoors] ... the plugin correctly assigns the style to the map (for a map provider with that style).
When set using a twig variable, eg. [map-marker-leaflet style="{{ myvar.style }}"] ... (and so long as a twig variable myvar has been created for that page), then the plugin correctly assigns the style.
This is done within the shortcode php file as follows:
$params = $sc->getParams(); //$sc is passed by the shortcode function
if (isset($params['style'])) {
$style = $this->grav['twig']->processString($params['style']);
} else $style = '';
But now I want to have [map-leaflet style="{{ page.header.mapstyle }}"... with the page header being
---
mapstyle: outdoors
---
However, within the shortcode plugin, $style is ending up as null.
It would seem that within $this->grav['twig']->processString() there is no access to the page.header object.
The grav['page'] object is available inside the shortcode, but this means analyzing the twig string for page.header and getting the field.
processString() will also take an array of variables, but I do not see how to change the object grav['page']->header() into a suitable array.
What am I missing?
Is there a shortcode plugin that accesses the page header in a similar way?