Example #1
0
/**
 * Implements template_preprocess_page.
 */
function foundation_access_preprocess_page(&$variables)
{
    // make sure we have lmsless enabled so we don't WSOD
    $variables['cis_lmsless'] = array('active' => array('title' => ''));
    if (module_exists('cis_lmsless')) {
        $variables['cis_lmsless'] = _cis_lmsless_theme_vars();
    }
    if (module_exists('cis_shortcodes')) {
        $block = cis_shortcodes_block_view('cis_shortcodes_block');
        if (!empty($block['content'])) {
            $variables['cis_shortcodes'] = $block['content'];
        }
    }
    // show staff / instructors the course tools menu
    if (_cis_connector_role_groupings(array('staff', 'teacher'))) {
        $variables['tabs_extras'][100][] = '<hr>';
        $variables['tabs_extras'][100][] = '<a href="#" data-reveal-id="block-menu-menu-course-tools-menu-nav-modal">' . t('Course Settings') . '</a>';
    }
    // wrap non-node content in an article tag
    if (isset($variables['page']['content']['system_main']['main'])) {
        $variables['page']['content']['system_main']['main']['#markup'] = '<article class="large-12 columns view-mode-full">' . $variables['page']['content']['system_main']['main']['#markup'] . '</article>';
    }
}
<?php

/**
 * @file
 * This template is used to print a single field in a view.
 *
 * It is not actually used in default Views, as this is registered as a theme
 * function which has better performance. For single overrides, the template is
 * perfectly okay.
 *
 * Variables available:
 * - $view: The view object
 * - $field: The field handler object that can process the input
 * - $row: The raw SQL result that can be used
 * - $output: The processed output that will normally be used.
 *
 * When fetching output from the $row, this construct should be used:
 * $data = $row->{$field->field_alias}
 *
 * The above will guarantee that you'll always get the correct data,
 * regardless of any changes in the aliasing that might happen if
 * the view is modified.
 */
// hate doing things this way but it's so much faster
if (isset($row->taxonomy_term_data_name) && _cis_connector_role_groupings(array('staff', 'teacher'))) {
    print $output;
} else {
    print $row->taxonomy_term_data_name;
}