theme settings page to learn about the options.';
drupal_set_message($msgthemeset, 'message');
}
endif; //end if access admin pages
/**
* Creates a link with prefix and suffix text
*
* @param $prefix
* The text to prefix the link.
* @param $suffix
* The text to suffix the link.
* @param $text
* The text to be enclosed with the anchor tag.
* @param $path
* The Drupal path being linked to, such as "admin/content/node". Can be an external
* or internal URL.
* - If you provide the full URL, it will be considered an
* external URL.
* - If you provide only the path (e.g. "admin/content/node"), it is considered an
* internal link. In this case, it must be a system URL as the url() function
* will generate the alias.
* @param $options
* An associative array that contains the following other arrays and values
* @param $attributes
* An associative array of HTML attributes to apply to the anchor tag.
* @param $query
* A query string to append to the link.
* @param $fragment
* A fragment identifier (named anchor) to append to the link.
* @param $absolute
* Whether to force the output to be an absolute link (beginning with http:).
* Useful for links that will be displayed outside the site, such as in an RSS
* feed.
* @param $html
* Whether the title is HTML or not (plain text)
* @return
* an HTML string containing a link to the given path.
*/
function _themesettings_link($prefix, $suffix, $text, $path, $options) {
return $prefix . (($text) ? l($text, $path, $options) : '') . $suffix;
}
function phptemplate_preprocess_page(&$vars) {
// thanks again ZEN masters
// Classes for body element. Allows advanced theming based on context
// (home page, node of certain type, etc.)
$body_classes = array();
$body_classes[] = ($vars['is_front']) ? 'front' : 'not-front';
$body_classes[] = ($vars['logged_in']) ? 'logged-in' : 'not-logged-in';
if ($vars['node']->type) {
// If on an individual node page, put the node type in the body classes
$body_classes[] = 'node-type-'. $vars['node']->type;
}
if ($vars['left'] && $vars['right']) {
$body_classes[] = 'two-sidebars';
}
elseif ($vars['left']) {
$body_classes[] = 'one-sidebar sidebar-left';
}
elseif ($vars['right']) {
$body_classes[] = 'one-sidebar sidebar-right';
}
else {
$body_classes[] = 'no-sidebars';
}
if (!$vars['is_front']) {
// Add unique classes for each page and website section
$path = drupal_get_path_alias($_GET['q']);
list($section,) = explode('/', $path, 2);
$body_classes[] = zen_id_safe('page-'. $path);
$body_classes[] = zen_id_safe('section-'. $section);
if (arg(0) == 'node') {
if (arg(1) == 'add') {
if ($section == 'node') {
array_pop($body_classes); // Remove 'section-node'
}
$body_classes[] = 'section-node-add'; // Add 'section-node-add'
}
elseif (is_numeric(arg(1)) && (arg(2) == 'edit' || arg(2) == 'delete')) {
if ($section == 'node') {
array_pop($body_classes); // Remove 'section-node'
}
$body_classes[] = 'section-node-'. arg(2); // Add 'section-node-edit' or 'section-node-delete'
}
}
}
if ((arg(3) != 'settings') && (arg(4) != 'adt_prt_galaxy')) {
$body_classes[] = 'notcolorform'; //prevent styling of input.form-text on color page, otherwise the color form isn't colored in.
}
$vars['closure'] .= '
sfy39587p01
';
$vars['body_classes'] = implode(' ', $body_classes); // Concatenate with spaces
// Hook into color.module
if (module_exists('color')) {
_color_page_alter($vars);
// prevent double loading of style.css
// ==>core in D6
}
// Generate menu tree from source of primary links
$vars['primary_links'] = menu_tree(variable_get('menu_primary_links_source', 'primary-links'));
/*** Widths of blocks in "preblocks" and "postblocks" regions ***/
$precount = substr_count($vars['preblocks'], 'class="block ');
$postcount = substr_count($vars['postblocks'], 'class="block ');
$prewidth = 99;
$postwidth = 99;
if ($precount > 1) {
$prewidth = round(100/$precount,3)-0.5;
}
if ($postcount > 1) {
$postwidth = round(100/$postcount,3)-0.5;
}
$vars['blockwidths'] = <<type : 'default';
$taxonomy_display = theme_get_setting('taxonomy_display_'. $taxonomy_content_type);
$taxonomy_format = theme_get_setting('taxonomy_format_'. $taxonomy_content_type);
if ((module_exists('taxonomy')) && ($taxonomy_display == 'all' || ($taxonomy_display == 'only' && $vars['page']))) {
$vocabularies = taxonomy_get_vocabularies($vars['node']->type);
$output = '';
$vocab_delimiter = '';
foreach ($vocabularies as $vocabulary) {
if (theme_get_setting('taxonomy_vocab_display_'. $taxonomy_content_type .'_'. $vocabulary->vid) == FALSE) {
$terms =taxonomy_node_get_terms_by_vocabulary($vars['node'], $vocabulary->vid);
if ($terms) {
$output .= ($taxonomy_format == 'vocab') ? ''. $vocabulary->name .': ' : '';
$links = array();
foreach ($terms as $term) {
$links[] = '- '. l($term->name, taxonomy_term_path($term), array('rel' => 'tag', 'title' => strip_tags($term->description))) .'
';
}
if ($taxonomy_format == 'list') {
$output .= $vocab_delimiter; // Add comma between vocabularies
$vocab_delimiter = ' / '; // Use a comma delimiter after first displayed vocabulary
}
$output .= implode(" / ", $links);
$output .= ($taxonomy_format == 'vocab') ? '
' : '';
}
}
}
if ($output != '') {
$output = '';
}
$vars['terms'] = $output;
}
else {
$vars['terms'] = '';
}
// Node Links
if (isset($vars['node']->links['node_read_more'])) {
$node_content_type = (theme_get_setting('readmore_enable_content_type') == 1) ? $vars['node']->type : 'default';
$vars['node']->links['node_read_more'] = array(
'title' => _themesettings_link(
theme_get_setting('readmore_prefix_'. $node_content_type),
theme_get_setting('readmore_suffix_'. $node_content_type),
theme_get_setting('readmore_'. $node_content_type),
'node/'. $vars['node']->nid,
array(
'attributes' => array('title' => theme_get_setting('readmore_title_'. $node_content_type)),
'query' => NULL, 'fragment' => NULL, 'absolute' => FALSE, 'html' => TRUE
)
),
'attributes' => array('class' => 'readmore-item'),
'html' => TRUE,
);
}
if (isset($vars['node']->links['comment_add'])) {
$node_content_type = (theme_get_setting('comment_enable_content_type') == 1) ? $vars['node']->type : 'default';
$vars['node']->links['comment_add'] = array(
'title' => _themesettings_link(
theme_get_setting('comment_add_prefix_'. $node_content_type),
theme_get_setting('comment_add_suffix_'. $node_content_type),
theme_get_setting('comment_add_'. $node_content_type),
"comment/reply/".$vars['node']->nid,
array(
'attributes' => array('title' => theme_get_setting('comment_add_title_'. $node_content_type)),
'query' => NULL, 'fragment' => 'comment-form', 'absolute' => FALSE, 'html' => TRUE
)
),
'attributes' => array('class' => 'comment-add-item'),
'html' => TRUE,
);
}
if (isset($vars['node']->links['comment_new_comments'])) {
$node_content_type = (theme_get_setting('comment_enable_content_type') == 1) ? $vars['node']->type : 'default';
$vars['node']->links['comment_new_comments'] = array(
'title' => _themesettings_link(
theme_get_setting('comment_new_prefix_'. $node_content_type),
theme_get_setting('comment_new_suffix_'. $node_content_type),
format_plural(
comment_num_new($vars['node']->nid),
theme_get_setting('comment_new_singular_'. $node_content_type),
theme_get_setting('comment_new_plural_'. $node_content_type)
),
"node/".$vars['node']->nid,
array(
'attributes' => array('title' => theme_get_setting('comment_new_title_'. $node_content_type)),
'query' => NULL, 'fragment' => 'new', 'absolute' => FALSE, 'html' => TRUE
)
),
'attributes' => array('class' => 'comment-new-item'),
'html' => TRUE,
);
}
if (isset($vars['node']->links['comment_comments'])) {
$node_content_type = (theme_get_setting('comment_enable_content_type') == 1) ? $vars['node']->type : 'default';
$vars['node']->links['comment_comments'] = array(
'title' => _themesettings_link(
theme_get_setting('comment_prefix_'. $node_content_type),
theme_get_setting('comment_suffix_'. $node_content_type),
format_plural(
comment_num_all($vars['node']->nid),
theme_get_setting('comment_singular_'. $node_content_type),
theme_get_setting('comment_plural_'. $node_content_type)
),
"node/".$vars['node']->nid,
array(
'attributes' => array('title' => theme_get_setting('comment_title_'. $node_content_type)),
'query' => NULL, 'fragment' => 'comments', 'absolute' => FALSE, 'html' => TRUE
)
),
'attributes' => array('class' => 'comment-item'),
'html' => TRUE,
);
}
$vars['links'] = theme('links', $vars['node']->links, array('class' => 'links inline'));
}
function phptemplate_preprocess_block(&$vars) {
$block = $vars['block'];
// Special classes for blocks
$block_classes = array();
$block_classes[] = 'block-'. $block->module;
$block_classes[] = 'region-'. $vars['block_zebra'];
$block_classes[] = $vars['zebra'];
$block_classes[] = 'region-count-'. $vars['block_id'];
$block_classes[] = 'count-'. $vars['id'];
$block_classes[] = $block->first_last;
$vars['block_classes'] = implode(' ', $block_classes);
$vars['edit_links'] = '';
if (theme_get_setting('block_edit') && user_access('administer blocks')) {
// Display 'edit block' for custom blocks.
if ($block->module == 'block') {
$edit_links[] = l('' . t('edit block') . '', 'admin/build/block/configure/' . $block->module . '/' . $block->delta,
array(
'attributes' => array(
'title' => t('edit the content of this block'),
'class' => 'block-edit',
),
'query' => drupal_get_destination(),
'html' => TRUE,
)
);
}
// Display 'configure' for other blocks.
else {
$edit_links[] = l('' . t('configure') . '', 'admin/build/block/configure/' . $block->module . '/' . $block->delta,
array(
'attributes' => array(
'title' => t('configure this block'),
'class' => 'block-config',
),
'query' => drupal_get_destination(),
'html' => TRUE,
)
);
}
// Display 'edit view' for Views blocks.
if ($block->module == 'views' && user_access('administer views')) {
$edit_links[] = l('' . t('edit view') . '', 'admin/build/views/edit/' . str_replace('-block', '', $block->delta),
array(
'attributes' => array(
'title' => t('edit the view that defines this block'),
'class' => 'block-edit-view',
),
'query' => drupal_get_destination(),
'fragment' => 'views-tab-block',
'html' => TRUE,
)
);
}
// Display 'edit menu' for Menu blocks.
elseif (($block->module == 'menu' || ($block->module == 'user' && $block->delta == 1)) && user_access('administer menu')) {
$menu_name = ($block->module == 'user') ? 'navigation' : $block->delta;
$edit_links[] = l('' . t('edit menu') . '', 'admin/build/menu-customize/' . $menu_name,
array(
'attributes' => array(
'title' => t('edit the menu that defines this block'),
'class' => 'block-edit-menu',
),
'query' => drupal_get_destination(),
'html' => TRUE,
)
);
}
// Display 'edit menu' for Menu block blocks.
elseif ($block->module == 'menu_block' && user_access('administer menu')) {
$menu_name = variable_get('menu_block_' . $block->delta . '_menu_name', 'navigation');
$edit_links[] = l('' . t('edit menu') . '', 'admin/build/menu-customize/' . $menu_name,
array(
'attributes' => array(
'title' => t('edit the menu that defines this block'),
'class' => 'block-edit-menu',
),
'query' => drupal_get_destination(),
'html' => TRUE,
)
);
}
$vars['edit_links_array'] = $edit_links;
$vars['edit_links'] = ''. implode(' ', $edit_links) .'
';
}
}
/**
* Override or insert PHPTemplate variables into the search_block_form template.
*
* @param $vars
* A sequential array of variables to pass to the theme template.
* @param $hook
* The name of the theme function being called (not used in this case.)
*/
function phptemplate_preprocess_search_block_form(&$vars, $hook) {
// Modify elements of the search form
unset($vars['form']['search_block_form']['#title']);
$vars['form']['submit']['#prefix'] = '';
$vars['form']['submit']['#value'] = t('Go');
$vars['form']['submit']['#suffix'] = '
';
// Rebuild the rendered version (search form only, rest remains unchanged)
unset($vars['form']['search_block_form']['#printed']);
$vars['search']['search_block_form'] = drupal_render($vars['form']['search_block_form']);
// Rebuild the rendered version (submit button, rest remains unchanged)
unset($vars['form']['submit']['#printed']);
$vars['search']['submit'] = drupal_render($vars['form']['submit']);
// Collect all form elements to make it easier to print the whole form.
$vars['search_form'] = implode($vars['search']);
}
/**
* Adds active/inactive to primary tabs
*/
function phptemplate_menu_local_task($link, $active = FALSE) {
return ''. $link ."\n";
}
/* Add span to tabs menu */
function phptemplate_menu_item_link($link) {
if (empty($link['localized_options'])) {
$link['localized_options'] = array();
}
// uncomment next line to explore content of $link arrays
// dsm($link);
if ($link['tab_root']) {
$options = array(
$link['localized_options'],
'HTML' => TRUE,
);
return l(''.$link['title'].'', $link['href'], array('html' => TRUE));
} else {
return l($link['title'], $link['href'], $link['localized_options']);
}
}
function zen_id_safe($string) {
if (is_numeric($string{0})) {
// If the first character is numeric, add 'n' in front
$string = 'n'. $string;
}
return strtolower(preg_replace('/[^a-zA-Z0-9_-]+/', '-', $string));
}
// Add first/last classes to blocks
function phptemplate_blocks($region) {
$output = '';
if ($list = block_list($region)) {
$i = 1;
$count = count($list);
foreach ($list as $key => $block) {
// $key == module_delta
if ($i == 1){ // is this the first block in this region?
$block->first_last = 'first';
}
if ($i == $count){ // is this the last block in this region?
$block->first_last = 'last';
}
$output .= theme('block', $block);
$i++;
}
}
// Add any content assigned to this region through drupal_set_content() calls.
$output .= drupal_get_content($region);
return $output;
}
/**
* Shift colors in HSL color space
* @param color
* CSS hex color to be shifted (e.g. #000000 )
* @param $h
* Hue shift, normalized to a fraction of 1
* @param $s
* Saturation shift, normalized to a fraction of 1
* @param $l
* Lightness shift, normalized to a fraction of 1
* @return a string containing a CSS hexcolor (e.g. #000000 )
*/
function color_shift($color,$h,$s,$l) {
$newcolor = _color_unpack($color,TRUE); // hex to RGB
$newcolor = _color_rgb2hsl($newcolor); // RGB to HSL
$newcolor[0] += $h;
//if ($newcolor[0] > 1) { $newcolor[0] = 1; }
//if ($newcolor[0] < 0) { $newcolor[0] = 0; }
$newcolor[1] += $s;
if ($newcolor[1] > 1) { $newcolor[1] = 1; }
if ($newcolor[1] < 0) { $newcolor[1] = 0; }
$newcolor[2] += $l;
if ($newcolor[2] > 1) { $newcolor[2] = 1; }
if ($newcolor[2] < 0) { $newcolor[2] = 0; }
$newcolor = _color_hsl2rgb($newcolor); // Back to RGB
$newcolor = _color_pack($newcolor,TRUE); // RGB back to hex
return $newcolor;
}
/**
* Autohift colors in HSL color space
* @param color
* CSS hex color to be shifted (e.g. #000000 )
* @param $X_min
* Hue/Saturation/Lightness minimum value, normalized to a fraction of 1
* @param $X_max
* Hue/Saturation/Lightness maximum value, normalized to a fraction of 1
* @return a string containing a CSS hexcolor (e.g. #000000 )
*/
function color_autoshift($color,$min_h,$max_h,$min_s,$max_s,$min_l,$max_l) {
$newcolor = _color_unpack($color,TRUE); // hex to RGB
$newcolor = _color_rgb2hsl($newcolor); // RGB to HSL
if ($min_h){
if ($newcolor[0] < $min_h) { $newcolor[0] = $min_h; }
}
if ($max_h){
if ($newcolor[0] > $max_h) { $newcolor[0] = $max_h; }
}
if ($min_s){
if ($newcolor[1] < $min_s) { $newcolor[1] = $min_s; }
}
if ($max_s){
if ($newcolor[1] > $max_s) { $newcolor[1] = $max_s; }
}
if ($min_l){
if ($newcolor[2] < $min_l) { $newcolor[2] = $min_l; }
}
if ($max_l){
if ($newcolor[2] > $max_l) { $newcolor[2] = $max_l; }
}
$newcolor = _color_hsl2rgb($newcolor); // Back to RGB
$newcolor = _color_pack($newcolor,TRUE); // RGB back to hex
return $newcolor;
}
/*
* Initialize theme settings
*/
if (is_null(theme_get_setting('fixedfluid'))) { // <-- if settings have never ben set
global $theme_key;
$node_types = node_get_types('names');
/*
* The default values for the theme variables. Make sure $defaults exactly
* matches the $defaults in the theme-settings.php file.
*/
$defaults = array(
'fixedfluid' => 'px',
'layout_width_fluid' => 80,
'layout_width_fixed' => 900,
'sidebar_width' => '20',
'expand_admin' => 0,
'layout_min_width' => 0,
'layout_max_width' => 0,
'taxonomy_display_default' => 'only',
'taxonomy_format_default' => 'vocab',
'taxonomy_enable_content_type' => 0,
'readmore_default' => t('Read more'),
'readmore_title_default' => t('Read the rest of this article.'),
'readmore_prefix_default' => '',
'readmore_suffix_default' => '',
'readmore_enable_content_type' => 0,
'comment_singular_default' => t('1 comment'),
'comment_plural_default' => t('@count comments'),
'comment_title_default' => t('Go to the first comment.'),
'comment_prefix_default' => '',
'comment_suffix_default' => '',
'comment_new_singular_default' => t('1 new comment'),
'comment_new_plural_default' => t('@count new comments'),
'comment_new_title_default' => t('Go to the first new comment.'),
'comment_new_prefix_default' => '',
'comment_new_suffix_default' => '',
'comment_add_default' => t('Add new comment'),
'comment_add_title_default' => t('Add a new comment to this page.'),
'comment_add_prefix_default' => '',
'comment_add_suffix_default' => '',
'comment_enable_content_type' => 0,
'commentheader' => 'Comments:',
'iepngfix' => 1,
'link_icons' => 0,
'superfish' => 1,
'block_edit' => 1,
'force_eq_heights' => 1,
'input_example' => 1,
'timestamp' => 0,
);
// Make the default content-type settings the same as the default theme settings,
// so we can tell if content-type-specific settings have been altered.
$defaults = array_merge($defaults, theme_get_settings());
// Set the default values for content-type-specific settings
foreach ($node_types as $type => $name) {
$defaults["taxonomy_display_{$type}"] = $defaults['taxonomy_display_default'];
$defaults["taxonomy_format_{$type}"] = $defaults['taxonomy_format_default'];
$defaults["submitted_by_author_{$type}"] = $defaults['submitted_by_author_default'];
$defaults["submitted_by_date_{$type}"] = $defaults['submitted_by_date_default'];
$defaults["readmore_{$type}"] = $defaults['readmore_default'];
$defaults["readmore_title_{$type}"] = $defaults['readmore_title_default'];
$defaults["readmore_prefix_{$type}"] = $defaults['readmore_prefix_default'];
$defaults["readmore_suffix_{$type}"] = $defaults['readmore_suffix_default'];
$defaults["comment_singular_{$type}"] = $defaults['comment_singular_default'];
$defaults["comment_plural_{$type}"] = $defaults['comment_plural_default'];
$defaults["comment_title_{$type}"] = $defaults['comment_title_default'];
$defaults["comment_prefix_{$type}"] = $defaults['comment_prefix_default'];
$defaults["comment_suffix_{$type}"] = $defaults['comment_suffix_default'];
$defaults["comment_new_singular_{$type}"] = $defaults['comment_new_singular_default'];
$defaults["comment_new_plural_{$type}"] = $defaults['comment_new_plural_default'];
$defaults["comment_new_title_{$type}"] = $defaults['comment_new_title_default'];
$defaults["comment_new_prefix_{$type}"] = $defaults['comment_new_prefix_default'];
$defaults["comment_new_suffix_{$type}"] = $defaults['comment_new_suffix_default'];
$defaults["comment_add_{$type}"] = $defaults['comment_add_default'];
$defaults["comment_add_title_{$type}"] = $defaults['comment_add_title_default'];
$defaults["comment_add_prefix_{$type}"] = $defaults['comment_add_prefix_default'];
$defaults["comment_add_suffix_{$type}"] = $defaults['comment_add_suffix_default'];
}
// Get default theme settings.
$settings = theme_get_settings($theme_key);
// If content type-specifc settings are not enabled, reset the values
if (!$settings['readmore_enable_content_type']) {
foreach ($node_types as $type => $name) {
$settings["readmore_{$type}"] = $settings['readmore_default'];
$settings["readmore_title_{$type}"] = $settings['readmore_title_default'];
$settings["readmore_prefix_{$type}"] = $settings['readmore_prefix_default'];
$settings["readmore_suffix_{$type}"] = $settings['readmore_suffix_default'];
}
}
if (!$settings['comment_enable_content_type']) {
foreach ($node_types as $type => $name) {
$defaults["comment_singular_{$type}"] = $defaults['comment_singular_default'];
$defaults["comment_plural_{$type}"] = $defaults['comment_plural_default'];
$defaults["comment_title_{$type}"] = $defaults['comment_title_default'];
$defaults["comment_prefix_{$type}"] = $defaults['comment_prefix_default'];
$defaults["comment_suffix_{$type}"] = $defaults['comment_suffix_default'];
$defaults["comment_new_singular_{$type}"] = $defaults['comment_new_singular_default'];
$defaults["comment_new_plural_{$type}"] = $defaults['comment_new_plural_default'];
$defaults["comment_new_title_{$type}"] = $defaults['comment_new_title_default'];
$defaults["comment_new_prefix_{$type}"] = $defaults['comment_new_prefix_default'];
$defaults["comment_new_suffix_{$type}"] = $defaults['comment_new_suffix_default'];
$defaults["comment_add_{$type}"] = $defaults['comment_add_default'];
$defaults["comment_add_title_{$type}"] = $defaults['comment_add_title_default'];
$defaults["comment_add_prefix_{$type}"] = $defaults['comment_add_prefix_default'];
$defaults["comment_add_suffix_{$type}"] = $defaults['comment_add_suffix_default'];
}
}
// Don't save the toggle_node_info_ variables
if (module_exists('node')) {
foreach (node_get_types() as $type => $name) {
unset($settings['toggle_node_info_'. $type]);
}
}
// Save default theme settings
variable_set(
str_replace('/', '_', 'theme_'. $theme_key .'_settings'),
array_merge($defaults, $settings)
);
// Force refresh of Drupal internals
theme_get_setting('', TRUE);
}
if (theme_get_setting('timestamp') > 0) {
GLOBAL $theme;
drupal_add_css(file_directory_path().'/cto-'.$theme.'.css', 'theme', 'all');
}
// Override color module form to change color semantics and if necessary remove the preview
function phptemplate_color_scheme_form($form) {
$form['palette']['top']['#title'] = 'Accents';
$form['palette']['top']['#prefix'] = ''.t('To keep headings black, set accent color the same as primary color. Setting a different color as accent color will colorize headings.').'
';
$form['palette']['bottom']['#prefix'] = '';
$form['palette']['bottom']['#suffix'] = '
';
// Include stylesheet
$theme = $form['theme']['#value'];
$info = $form['info']['#value'];
drupal_add_css($theme_path . $info['preview_css']);
// Wrapper
$output .= '';
return $output;
}
if ((arg(2) == 'themes') && (arg(3) == 'settings') && (arg(4) != FALSE)) {
drupal_add_js($theme_path .'js/adt-livepreview.js');
drupal_add_js(array('t_s_page' => arg(4)), 'setting');
}
/* Jquery theme prerender path */
drupal_add_js(array('theme_path' => $abs_theme_path), 'setting');
drupal_add_js(array('current_theme' => $theme), 'setting');
if (theme_get_setting('force_eq_heights')) {
//Load equal heights Jquery plugin
drupal_add_js($theme_path .'js/jQuery.equalHeights.js');
}
if (theme_get_setting('superfish')) {
//Load superfish drop-down scripts
drupal_add_js($theme_path .'js/hoverIntent.js');
drupal_add_js($theme_path .'js/adt-superfish.js');
drupal_add_js($theme_path .'js/invoke-superfish.js');
}
if (theme_get_setting('input_example')) {
drupal_add_js($theme_path .'js/jquery.example.min.js');
}
// Load the custom stylesheet. The extra parameters are added to make this stylesheet load last, so that it may override all other stylesheets.
if (file_exists($theme_path . 'custom/style-custom.css')) {
drupal_add_css($theme_path . 'custom/style-custom.css', 'theme', 'all');
}
// Load custom template.php code
if (file_exists($theme_path . 'custom/template.php')) {
include $theme_path . 'custom/template.php';
}
/*!
* Dynamic display block preprocess functions
* Copyright (c) 2008 - 2009 P. Blaauw All rights reserved.
* Version 1.6 (01-OCT-2009)
* Licenced under GPL license
* http://www.gnu.org/licenses/gpl.html
*/
/**
* Override or insert variables into the ddblock_cycle_block_content templates.
* Used to convert variables from view_fields to slider_items template variables
*
* @param $vars
* An array of variables to pass to the theme template.
*
*/
function adt_prt_galaxy_preprocess_ddblock_cycle_block_content(&$vars) {
drupal_set_message('This function 1 is called
');
drupal_set_message('' . var_export($vars['settings']['view_name'], true) . '
');
drupal_set_message('' . var_export($vars['content'][0], true) . '
');
if ($vars['output_type'] == 'view_fields') {
$content = array();
// Add slider_items for the template
// If you use the devel module uncomment the following line to see the theme variables
// dsm($vars['settings']['view_name']);
// dsm($vars['content'][0]);
// If you don't use the devel module uncomment the following line to see the theme variables
// drupal_set_message('' . var_export($vars['settings']['view_name'], true) . '
');
// drupal_set_message('' . var_export($vars['content'][0], true) . '
');
if ($vars['settings']['view_name'] == 'news_items') {
if (!empty($vars['content'])) {
foreach ($vars['content'] as $key1 => $result) {
// add slide_image variable
if (isset($result->node_data_field_pager_item_text_field_image_fid)) {
// get image id
$fid = $result->node_data_field_pager_item_text_field_image_fid;
// get path to image
$filepath = db_result(db_query("SELECT filepath FROM {files} WHERE fid = %d", $fid));
// use imagecache (imagecache, preset_name, file_path, alt, title, array of attributes)
if (module_exists('imagecache') && is_array(imagecache_presets()) && $vars['imgcache_slide'] <> ''){
$slider_items[$key1]['slide_image'] =
theme('imagecache',
$vars['imgcache_slide'],
$filepath,
check_plain($result->node_title));
}
else {
$slider_items[$key1]['slide_image'] =
'
';
}
}
// add slide_text variable
if (isset($result->node_data_field_pager_item_text_field_slide_text_value)) {
$slider_items[$key1]['slide_text'] = check_markup($result->node_data_field_pager_item_text_field_slide_text_value);
}
// add slide_title variable
if (isset($result->node_title)) {
$slider_items[$key1]['slide_title'] = check_plain($result->node_title);
}
// add slide_read_more variable and slide_node variable
if (isset($result->nid)) {
$slider_items[$key1]['slide_read_more'] = l('Read more...', 'node/' . $result->nid);
$slider_items[$key1]['slide_node'] = base_path() . 'node/' . $result->nid;
}
}
}
}
$vars['slider_items'] = $slider_items;
}
}
/**
* Override or insert variables into the ddblock_cycle_pager_content templates.
* Used to convert variables from view_fields to pager_items template variables
* Only used for custom pager items
*
* @param $vars
* An array of variables to pass to the theme template.
*
*/
function adt_prt_galaxy_preprocess_ddblock_cycle_pager_content(&$vars) {
drupal_set_message('' . var_export($vars['pager_settings'], true) . '
');
drupal_set_message('' . var_export($vars['content'][0], true) . '
');
if (($vars['output_type'] == 'view_fields') && ($vars['pager_settings']['pager'] == 'custom-pager')){
$content = array();
// Add pager_items for the template
// If you use the devel module uncomment the following lines to see the theme variables
// dsm($vars['pager_settings']['view_name']);
// dsm($vars['content'][0]);
// If you don't use the devel module uncomment the following lines to see the theme variables
// drupal_set_message('' . var_export($vars['pager_settings'], true) . '
');
// drupal_set_message('' . var_export($vars['content'][0], true) . '
');
if ($vars['pager_settings']['view_name'] == 'news_items') {
if (!empty($vars['content'])) {
foreach ($vars['content'] as $key1 => $result) {
// add pager_item_image variable
if (isset($result->node_data_field_pager_item_text_field_image_fid)) {
$fid = $result->node_data_field_pager_item_text_field_image_fid;
$filepath = db_result(db_query("SELECT filepath FROM {files} WHERE fid = %d", $fid));
// use imagecache (imagecache, preset_name, file_path, alt, title, array of attributes)
if (module_exists('imagecache') &&
is_array(imagecache_presets()) &&
$vars['imgcache_pager_item'] <> ''){
$pager_items[$key1]['image'] =
theme('imagecache',
$vars['pager_settings']['imgcache_pager_item'],
$filepath,
check_plain($result->node_data_field_pager_item_text_field_pager_item_text_value));
}
else {
$pager_items[$key1]['image'] =
'
';
}
}
// add pager_item _text variable
if (isset($result->node_data_field_pager_item_text_field_pager_item_text_value)) {
$pager_items[$key1]['text'] = check_plain($result->node_data_field_pager_item_text_field_pager_item_text_value);
}
}
}
}
$vars['pager_items'] = $pager_items;
}
}