1

In the context module, how does the reaction Theme Page work? I am confused how to use it in my theme

I am using an Omega subtheme and want to display the Section title used in the context to show up in a region. How can I get this value to show?

1

You need to use a theme preprocess hook to pass the variable to the right zone template. Here's how I added it to my header zone:

function my_theme_preprocess_zone(&$vars) {
    $zone = $vars['zone'];

    if ('header' == $zone) {
        $theme = alpha_get_theme();

        // set via context module
        if (isset($theme->page['section_title'])) {
            $vars['section_title'] = $theme->page['section_title'];
        }
    }
}

Then in your zone--header.tpl.php file

<?php if (isset($section_title)): ?>
<div class="grid-<?php print $columns ?>">
    <h1 class="section-title"><?= $section_title ?></h1>
</div>
<?php endif; ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.