groups/themes/openstack/template.php
Marton Kiss cf050bd27c Fix map marker content
Refactor map marker view mode from full view to teaser, remove 'read more'
and 'login or register' links of teaser view.

Change-Id: I66180616f8fbcd841841c423a9c2059bf0028f73
2014-07-28 13:44:59 +02:00

182 lines
6.0 KiB
PHP

<?php
/**
* @file
* Contains the theme's functions to manipulate Drupal's default markup.
*
* Complete documentation for this file is available online.
* @see https://drupal.org/node/1728096
*/
/**
* Alter page elements.
*
*/
function openstack_page_alter(&$page) {
// Relocate utility links from header to toolbar region.
if (isset($page['header']['commons_utility_links_commons_utility_links'])) {
$page['toolbar']['commons_utility_links_commons_utility_links'] =
$page['header']['commons_utility_links_commons_utility_links'];
unset($page['header']['commons_utility_links_commons_utility_links']);
}
}
/**
* Override or insert variables into the maintenance page template.
*
* @param $variables
* An array of variables to pass to the theme template.
* @param $hook
* The name of the template being rendered ("maintenance_page" in this case.)
*/
/* -- Delete this line if you want to use this function
function STARTERKIT_preprocess_maintenance_page(&$variables, $hook) {
// When a variable is manipulated or added in preprocess_html or
// preprocess_page, that same work is probably needed for the maintenance page
// as well, so we can just re-use those functions to do that work here.
STARTERKIT_preprocess_html($variables, $hook);
STARTERKIT_preprocess_page($variables, $hook);
}
// */
/**
* Override or insert variables into the html templates.
*
* @param $variables
* An array of variables to pass to the theme template.
* @param $hook
* The name of the template being rendered ("html" in this case.)
*/
/* -- Delete this line if you want to use this function
function STARTERKIT_preprocess_html(&$variables, $hook) {
$variables['sample_variable'] = t('Lorem ipsum.');
// The body tag's classes are controlled by the $classes_array variable. To
// remove a class from $classes_array, use array_diff().
//$variables['classes_array'] = array_diff($variables['classes_array'], array('class-to-remove'));
}
// */
/**
* Override or insert variables into the page templates.
*
* @param $variables
* An array of variables to pass to the theme template.
* @param $hook
* The name of the template being rendered ("page" in this case.)
*/
/* -- Delete this line if you want to use this function
function STARTERKIT_preprocess_page(&$variables, $hook) {
$variables['sample_variable'] = t('Lorem ipsum.');
}
// */
/**
* Override or insert variables into the node templates.
*
* @param $variables
* An array of variables to pass to the theme template.
* @param $hook
* The name of the template being rendered ("node" in this case.)
*/
function openstack_preprocess_node(&$variables, $hook) {
$variables['sample_variable'] = t('Lorem ipsum.');
// Optionally, run node-type-specific preprocess functions, like
// STARTERKIT_preprocess_node_page() or STARTERKIT_preprocess_node_story().
$function = __FUNCTION__ . '_' . $variables['node']->type;
if (function_exists($function)) {
$function($variables, $hook);
}
}
function openstack_preprocess_node_event(&$variables, $hook) {
if ($variables['teaser']) {
$variables['theme_hook_suggestions'][] = 'node__' . $variables['node']->type . '__teaser';
$variables['display_submitted'] = False;
$variables['user_picture'] = '';
$variables['content']['links'] = '';
// unset($variables['submitted']);
// $variables['submitted'] = 'XXX';
}
// echo "<pre>";print_r($variables['display_submitted']);
// die('-y-');
}
/**
* Preprocess group node, remove 'read more' and 'comment login' links
* from teaser.
*/
function openstack_preprocess_node_group(&$variables, $hook) {
if ($variables['view_mode'] == 'teaser') {
unset($variables['content']['links']['node']['#links']['node-readmore']);
unset($variables['content']['links']['comment']['#links']['comment_forbidden']);
}
}
function openstack_preprocess_views_view(&$variables) {
$view = $variables['view'];
if ($view->name == 'commons_events_upcoming') {
$view->display_handler->set_option('filters', array());
$view->display[$view->current_display]->handler->options["title"] = t('Upcoming events');
// $filters = $view->display_handler->get_option('filters');
// echo "<pre>";print_r($filters);
// die('-x-');
}
}
/**
* Override or insert variables into the comment templates.
*
* @param $variables
* An array of variables to pass to the theme template.
* @param $hook
* The name of the template being rendered ("comment" in this case.)
*/
/* -- Delete this line if you want to use this function
function STARTERKIT_preprocess_comment(&$variables, $hook) {
$variables['sample_variable'] = t('Lorem ipsum.');
}
// */
/**
* Override or insert variables into the region templates.
*
* @param $variables
* An array of variables to pass to the theme template.
* @param $hook
* The name of the template being rendered ("region" in this case.)
*/
/* -- Delete this line if you want to use this function
function STARTERKIT_preprocess_region(&$variables, $hook) {
// Don't use Zen's region--sidebar.tpl.php template for sidebars.
//if (strpos($variables['region'], 'sidebar_') === 0) {
// $variables['theme_hook_suggestions'] = array_diff($variables['theme_hook_suggestions'], array('region__sidebar'));
//}
}
// */
/**
* Override or insert variables into the block templates.
*
* @param $variables
* An array of variables to pass to the theme template.
* @param $hook
* The name of the template being rendered ("block" in this case.)
*/
/* -- Delete this line if you want to use this function
function STARTERKIT_preprocess_block(&$variables, $hook) {
// Add a count to all the blocks in the region.
// $variables['classes_array'][] = 'count-' . $variables['block_id'];
// By default, Zen will use the block--no-wrapper.tpl.php for the main
// content. This optional bit of code undoes that:
//if ($variables['block_html_id'] == 'block-system-main') {
// $variables['theme_hook_suggestions'] = array_diff($variables['theme_hook_suggestions'], array('block__no_wrapper'));
//}
}
// */