/** * Implements template_preprocess_page. */ function foundation_access_preprocess_page(&$variables) { $variables['contentwrappers'] = _elmsln_core_path_is_wrapped(current_path()); $menu_item = menu_get_item(); // allow modules to supply accessibility enhancements to the menu $a11y = module_invoke_all('fa_a11y'); drupal_alter('fa_a11y', $a11y); // add in the form api wrapper meta properties to render as materialize collapse $a11y['#type'] = 'fieldset'; $a11y['#materialize'] = array('type' => 'collapsible_wrapper'); $a11y['#attributes'] = array('class' => array('collapsible'), 'data-collapsible' => 'accordion'); $variables['a11y'] = drupal_render($a11y); // sniff out if this is a view if ($menu_item['page_callback'] == 'views_page') { // try and auto append exposed filters to our local_subheader region $bid = '-exp-' . $menu_item['page_arguments'][0] . '-' . (is_array($menu_item['page_arguments'][1]) ? $menu_item['page_arguments'][1][0] : $menu_item['page_arguments'][1]); $block = module_invoke('views', 'block_view', $bid); $variables['page']['local_subheader'][$bid] = $block['content']; } $variables['distro'] = elmsln_core_get_profile_key(); // make sure we have lmsless enabled so we don't WSOD $variables['cis_lmsless'] = array('active' => array('title' => '')); // support for lmsless since we don't require it if (module_exists('cis_lmsless')) { $variables['cis_lmsless'] = _cis_lmsless_theme_vars(); } // support for cis_shortcodes if (module_exists('cis_shortcodes')) { $block = cis_shortcodes_block_view('cis_shortcodes_block'); if (!empty($block['content'])) { $variables['cis_shortcodes'] = $block['content']; } else { $variables['cis_shortcodes'] = ''; } } else { $variables['cis_shortcodes'] = ''; } // support for entity_iframe if (module_exists('entity_iframe')) { $block = entity_iframe_block_view('entity_iframe_block'); if (!empty($block['content'])) { $variables['cis_shortcodes'] .= $block['content']; } } // 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="l12 col view-mode-full">' . $variables['page']['content']['system_main']['main']['#markup'] . '</article>'; } /** * @todo Get rid of this logic and put it somewhere else * based on the new design. */ // add a sharing url to view the specific section if (module_exists('cis_connector')) { $url_options = array('absolute' => TRUE); // check for setting section context $current_section = _cis_connector_section_context(); if (isset($current_section) && $current_section) { $url_options['query']['elmsln_active_section'] = $current_section; } // check for setting course context $current_course = _cis_connector_course_context(); if (isset($current_course) && $current_course) { $url_options['query']['elmsln_active_course'] = $current_course; } $current_page = url(current_path(), $url_options); // establish the fieldset container for shortcodes $field['cis_section_share'] = array('#type' => 'fieldset', '#collapsed' => FALSE, '#collapsible' => TRUE, '#title' => t('Share this page')); $field['cis_section_share']['cis_section_share_link'] = array('#title' => t('Page URL'), '#value' => $current_page, '#type' => 'textfield', '#weight' => 0); $variables['cis_section_share'] = $field; } // attempt to find an edit path for the current page if (isset($variables['tabs']) && is_array($variables['tabs']['#primary'])) { $edit_path = arg(0) . '/' . arg(1) . '/edit'; foreach ($variables['tabs']['#primary'] as $key => $tab) { if (isset($tab['#link']['href']) && $tab['#link']['href'] == $edit_path) { $variables['edit_path'] = base_path() . $edit_path; // hide the edit tab cause our on canvas pencil does this unset($variables['tabs']['#primary'][$key]); } } } }
* 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->tid)) { if ($gid = _cis_section_load_section_by_id(_cis_connector_section_context())) { $field_conditions = array('og_group_ref' => array('target_id', array($gid), 'IN')); } $field_conditions['field_editorial_exercise'] = array('tid', array($row->tid), 'IN'); $submission = _cis_connector_assemble_entity_list('node', 'editorial_journal_entry', 'nid', 'title', $field_conditions, array('uid' => $GLOBALS['user']->uid)); $output = ''; foreach ($submission as $nid => $title) { $output .= l($title, 'node/' . $nid) . ' '; } } if (empty($output)) { $output = l(t('Submit entry'), 'node/add/editorial-journal-entry', array('query' => array('edit[field_editorial_exercise][und]=' => $row->tid))); } print $output;
/** * Implements template_preprocess_page. */ function foundation_access_preprocess_page(&$variables) { $menu_item = menu_get_item(); // sniff out if this is a view if ($menu_item['page_callback'] == 'views_page') { // try and auto append exposed filters to our local_subheader region $bid = '-exp-' . $menu_item['page_arguments'][0] . '-' . (is_array($menu_item['page_arguments'][1]) ? $menu_item['page_arguments'][1][0] : $menu_item['page_arguments'][1]); $block = module_invoke('views', 'block_view', $bid); $variables['page']['local_subheader'][$bid] = $block['content']; } $variables['distro'] = variable_get('install_profile', 'standard'); // load registry for this distro $settings = _cis_connector_build_registry($variables['distro']); $home_text = isset($settings['default_title']) ? $settings['default_title'] : $variables['distro']; $variables['home'] = l('<div class="' . $variables['distro'] . '-home elmsln-home-icon icon-' . $variables['distro'] . '-black etb-modal-icons"></div><span>' . $home_text . '</span>', '<front>', array('html' => TRUE, 'attributes' => array('class' => array($variables['distro'] . '-home-button', 'elmsln-home-button-link')))); // ensure header has something in it in the first place if (isset($variables['page']['header'])) { $keys = array_keys($variables['page']['header']); $keyname = array_shift($keys); $variables['page']['header'][$keyname]['#prefix'] = $variables['home']; } // make sure we have lmsless enabled so we don't WSOD $variables['cis_lmsless'] = array('active' => array('title' => '')); // support for lmsless since we don't require it if (module_exists('cis_lmsless')) { $variables['cis_lmsless'] = _cis_lmsless_theme_vars(); } // support for cis_shortcodes if (module_exists('cis_shortcodes')) { $block = cis_shortcodes_block_view('cis_shortcodes_block'); if (!empty($block['content'])) { $variables['cis_shortcodes'] = $block['content']; } } else { $variables['cis_shortcodes'] = ''; } // support for entity_iframe if (module_exists('entity_iframe')) { $block = entity_iframe_block_view('entity_iframe_block'); if (!empty($block['content'])) { $variables['cis_shortcodes'] .= $block['content']; } } // 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>'; } /** * @todo Get rid of this logic and put it somewhere else * based on the new design. */ // add a sharing url to view the specific section if (module_exists('cis_connector')) { $url_options = array('absolute' => TRUE); $current_section = _cis_connector_section_context(); if (isset($current_section) && $current_section) { $url_options['query']['elmsln_active_course'] = $current_section; } $current_page = url(current_path(), $url_options); // establish the fieldset container for shortcodes $field['cis_section_share'] = array('#type' => 'fieldset', '#collapsed' => FALSE, '#collapsible' => TRUE, '#title' => t('Share this page')); $field['cis_section_share']['cis_section_share_link'] = array('#title' => t('Page URL'), '#value' => $current_page, '#type' => 'textfield', '#weight' => 0); $variables['cis_section_share'] = $field; } // attempt to find an edit path for the current page if (isset($variables['tabs']) && is_array($variables['tabs']['#primary'])) { foreach ($variables['tabs']['#primary'] as $key => $tab) { $edit_path = arg(0) . '/' . arg(1) . '/edit'; if (isset($tab['#link']['href']) && $tab['#link']['href'] == $edit_path) { $variables['edit_path'] = base_path() . $edit_path; // hide the edit tab cause our on canvas pencil does this unset($variables['tabs']['#primary'][$key]); } } } }
/** * 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' => '')); // support for lmsless since we don't require it if (module_exists('cis_lmsless')) { $variables['cis_lmsless'] = _cis_lmsless_theme_vars(); } // support for cis_shortcodes if (module_exists('cis_shortcodes')) { $block = cis_shortcodes_block_view('cis_shortcodes_block'); if (!empty($block['content'])) { $variables['cis_shortcodes'] = $block['content']; } } else { $variables['cis_shortcodes'] = ''; } // support for entity_iframe if (module_exists('entity_iframe')) { $block = entity_iframe_block_view('entity_iframe_block'); if (!empty($block['content'])) { $variables['cis_shortcodes'] .= $block['content']; } } // 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>'; } /** * @todo Get rid of this logic and put it somewhere else * based on the new design. */ // add a sharing url to view the specific section if (module_exists('cis_connector')) { $url_options = array('absolute' => TRUE); $current_section = _cis_connector_section_context(); if (isset($current_section) && $current_section) { $url_options['query']['elmsln_active_course'] = $current_section; } $current_page = url(current_path(), $url_options); // establish the fieldset container for shortcodes $field['cis_section_share'] = array('#type' => 'fieldset', '#collapsed' => FALSE, '#collapsible' => TRUE, '#title' => t('Share this page')); $field['cis_section_share']['cis_section_share_link'] = array('#title' => t('Page URL'), '#value' => $current_page, '#type' => 'textfield', '#weight' => 0); $variables['cis_section_share'] = $field; } }