本文整理汇总了PHP中path_to_theme函数的典型用法代码示例。如果您正苦于以下问题:PHP path_to_theme函数的具体用法?PHP path_to_theme怎么用?PHP path_to_theme使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了path_to_theme函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: phptemplate_settings
/**
* Implementation of THEMEHOOK_settings() function.
*
* @param $saved_settings
* array An array of saved settings for this theme.
* @return
* array A form array.
*/
function phptemplate_settings($saved_settings)
{
// Empty the cached css...
cache_clear_all('abessive_custom_css', 'cache');
$form = array();
require_once path_to_theme() . '/abessive_settings.php';
// Add Farbtastic color picker
drupal_add_css('misc/farbtastic/farbtastic.css', 'module', 'all', FALSE);
drupal_add_js('misc/farbtastic/farbtastic.js');
drupal_add_js(path_to_theme() . '/theme-settings.js');
$defaults = _abessive_default_settings();
$settings = array_merge($defaults, $saved_settings);
$form['abessive_picker'] = array('#type' => 'markup', '#value' => '<div id="picker"></div>');
$form['abessive_background_color'] = array('#type' => 'textfield', '#title' => t('Background Color'), '#description' => t('What colour should the body background behind all the containers be? Default: %val', array('%val' => $defaults['abessive_background_color'])), '#default_value' => $settings['abessive_background_color'], '#size' => 7, '#maxlength' => 7, '#prefix' => '<div class="container-inline">', '#suffix' => '</div>', '#attributes' => array('class' => 'form-item-use-colorpicker'), '#element_validate' => array('abessive_validate_hex_field'));
$form['abessive_border_color'] = array('#type' => 'textfield', '#title' => t('Border Color'), '#description' => t('What colour should the border around all the containers be? Default: %val', array('%val' => $defaults['abessive_border_color'])), '#default_value' => $settings['abessive_border_color'], '#size' => 7, '#maxlength' => 7, '#prefix' => '<div class="container-inline">', '#suffix' => '</div>', '#attributes' => array('class' => 'form-item-use-colorpicker'), '#element_validate' => array('abessive_validate_hex_field'));
$form['abessive_content_background_color'] = array('#type' => 'textfield', '#title' => t('Content Background Color'), '#description' => t('What colour should the background of all the containers be? Default: %val', array('%val' => $defaults['abessive_content_background_color'])), '#default_value' => $settings['abessive_content_background_color'], '#size' => 7, '#maxlength' => 7, '#prefix' => '<div class="container-inline">', '#suffix' => '</div>', '#attributes' => array('class' => 'form-item-use-colorpicker'), '#element_validate' => array('abessive_validate_hex_field', 'abessive_calculate_gradient'));
$form['abessive_content_background_color']['abessive_r5'] = $form['abessive_content_background_color']['abessive_r4'] = $form['abessive_content_background_color']['abessive_r3'] = $form['abessive_content_background_color']['abessive_r2'] = array('#type' => 'value', '#default_value' => 0);
$form['abessive_text_color'] = array('#type' => 'textfield', '#title' => t('Text Color'), '#description' => t('What colour should the text be? Default: %val', array('%val' => $defaults['abessive_text_color'])), '#default_value' => $settings['abessive_text_color'], '#size' => 7, '#maxlength' => 7, '#prefix' => '<div class="container-inline">', '#suffix' => '</div>', '#attributes' => array('class' => 'form-item-use-colorpicker'), '#element_validate' => array('abessive_validate_hex_field'));
$form['abessive_link_color'] = array('#type' => 'textfield', '#title' => t('Hyperlink Color'), '#description' => t('What colour should hyperlinks be? Default: %val', array('%val' => $defaults['abessive_link_color'])), '#default_value' => $settings['abessive_link_color'], '#size' => 7, '#maxlength' => 7, '#prefix' => '<div class="container-inline">', '#suffix' => '</div>', '#attributes' => array('class' => 'form-item-use-colorpicker'), '#element_validate' => array('abessive_validate_hex_field'));
$form['abessive_link_hover_color'] = array('#type' => 'textfield', '#title' => t('Hyperlink Hover Color'), '#description' => t('What colour should hyperlinks be when hovered over? Default: %val', array('%val' => $defaults['abessive_link_hover_color'])), '#default_value' => $settings['abessive_link_hover_color'], '#size' => 7, '#maxlength' => 7, '#prefix' => '<div class="container-inline">', '#suffix' => '</div>', '#attributes' => array('class' => 'form-item-use-colorpicker'), '#element_validate' => array('abessive_validate_hex_field'));
$form['abessive_link_active_color'] = array('#type' => 'textfield', '#title' => t('Hyperlink Active Color'), '#description' => t('What colour should active hyperlinks be? Default: %val', array('%val' => $defaults['abessive_link_active_color'])), '#default_value' => $settings['abessive_link_active_color'], '#size' => 7, '#maxlength' => 7, '#prefix' => '<div class="container-inline">', '#suffix' => '</div>', '#attributes' => array('class' => 'form-item-use-colorpicker'), '#element_validate' => array('abessive_validate_hex_field'));
$form['abessive_left_width'] = array('#type' => 'textfield', '#title' => t('Left Column Width'), '#description' => t('How wide should the left column be? Default: %val', array('%val' => $defaults['abessive_left_width'])), '#default_value' => $settings['abessive_left_width'], '#size' => 3, '#maxlength' => 3, '#prefix' => '<div class="container-inline">', '#suffix' => '</div>', '#field_suffix' => 'px', '#element_validate' => array('abessive_validate_numeric_field'));
$form['abessive_right_width'] = array('#type' => 'textfield', '#title' => t('Right Column Width'), '#description' => t('How wide should the right column be? Default: %val', array('%val' => $defaults['abessive_right_width'])), '#default_value' => $settings['abessive_right_width'], '#size' => 3, '#maxlength' => 3, '#prefix' => '<div class="container-inline">', '#suffix' => '</div>', '#field_suffix' => 'px', '#element_validate' => array('abessive_validate_numeric_field'));
$form['#submit'][] = 'abessive_submit_settings';
return $form;
}
示例2: render
/**
* Builds inner content, then hands off to layout-specified theme function for
* final render step.
*
* This is the outermost method in the Panels render pipeline. It calls the
* inner methods, which return a content array, which is in turn passed to the
* theme function specified in the layout plugin.
*
* @return string
* Themed & rendered HTML output.
*/
function render()
{
if (!empty($this->plugins['layout']['css'])) {
if (file_exists(path_to_theme() . '/' . $this->plugins['layout']['css'])) {
drupal_add_css(path_to_theme() . '/' . $this->plugins['layout']['css']);
} else {
drupal_add_css($this->plugins['layout']['path'] . '/' . $this->plugins['layout']['css']);
}
}
// This now comes after the CSS is added, because panels-within-panels must
// have their CSS added in the right order; inner content before outer content.
if (empty($this->display->cache['method']) || !empty($this->display->skip_cache)) {
$content = $this->render_regions();
} else {
$cache = panels_get_cached_content($this->display, $this->display->args, $this->display->context);
if ($cache === FALSE) {
$cache = new panels_cache_object();
$cache->set_content($this->render_regions());
panels_set_cached_content($cache, $this->display, $this->display->args, $this->display->context);
}
$content = $cache->content;
}
$output = theme($this->plugins['layout']['theme'], check_plain($this->display->css_id), $content, $this->display->layout_settings, $this->display, $this->plugins['layout'], $this);
return $output;
}
示例3: pluralsite_preprocess_page
function pluralsite_preprocess_page(&$variables, $hook)
{
$slogans = array(t('This is a new slogan 1'), t('This is a new slogan 2'), t('This is a new slogan 3'), t('This is a new slogan 4'), t('This is a new slogan 5'), t('This is a new slogan 6'), t('This is a new slogan 7'), t('This is a new slogan 8'));
$slogan = $slogans[array_rand($slogans)];
$variables['site_slogan'] = $slogan;
// $use_twitter = theme_get_setting('use_twitter');
// if ($use_twitter) {
// if ($cache = cache_get('pluralsite_tweets')) {
// $data = $cache -> $data;
// } else {
// $query = theme_get_setting('twitter_search_term');
// $query = drupal_encode_path($query);
// $response = drupal_http_request('https://twitter.com/search?q=' . $query);
// aerosmith&src=typd
// if ($response -> code == 200) {
// $data = json_decode($response->data);
// cache_set('pluralsite_tweets', $data, 'cache', 300);
// }
// }
// $tweet = $data->results[array_rand($data->results)];
// $variables['site_slogan'] = check_plain(html_entity_decode($tweet -> text));
// }
// Add new variables to page.tpl for footer
if ($variables['logged_in']) {
$variables['footer_message'] = t('Welcome @username, Lullabot love\'s you.', array('@username' => $variables['user']->name));
} else {
$variables['footer_message'] = t('Lullabot loves you');
}
// add css to front page
if ($variables['is_front'] === TRUE) {
drupal_add_css(path_to_theme() . '/css/front.css', array('group' => CSS_THEME, 'weight' => 10));
}
}
示例4: collectFiles
/**
* Build the code files.
*/
function collectFiles(&$files)
{
$theme_registry = theme_get_registry();
// Our theme base was set in our incoming component data.
$theme_base = $this->base_component->component_data['theme_hook_bases'][$this->name];
$theme_info = $theme_registry[$theme_base];
//drush_print_r($this);
//drush_print_r($theme_info);
// Get the original TPL file we want to copy.
// Due to how the theme registry works, this will be one of:
// - the original file from the module
// - an overridden tpl file in the current theme (eg, if you request
// node--article, and your theme has node.tpl, then you get that)
// - an overridden tpl file in a parent theme, same principle.
$original_tpl_file = $theme_info['path'] . '/' . $theme_info['template'] . '.tpl.php';
$tpl_code = file_get_contents($original_tpl_file);
//print $tpl_code;
$theme_path = path_to_theme();
// Try a 'templates' folder inside it.
if (file_exists($theme_path . '/templates')) {
$file_path .= 'templates';
} else {
$file_path = '';
}
$files['info'] = array('path' => $file_path, 'filename' => $this->name . '.tpl.php', 'body' => array($tpl_code));
}
示例5: msd15_preprocess_html
/**
* Implements hook_preprocess_html
*/
function msd15_preprocess_html(&$vars)
{
drupal_add_css('https://uom-design-system.s3.amazonaws.com/v1.0/uom.css', 'external');
drupal_add_css(path_to_theme() . '/css/style.css');
drupal_add_js('https://uom-design-system.s3.amazonaws.com/v1.0/uom.js', 'external');
drupal_add_js(path_to_theme() . '/js/main.js', array('scope' => 'footer'));
}
示例6: bootstrap_business_preprocess_html
/**
* Preprocess variables for html.tpl.php
*/
function bootstrap_business_preprocess_html(&$variables)
{
/**
* Add IE8 Support
*/
drupal_add_css(path_to_theme() . '/css/ie8.css', array('group' => CSS_THEME, 'browsers' => array('IE' => '(lt IE 9)', '!IE' => FALSE), 'preprocess' => FALSE));
drupal_add_css(path_to_theme() . '/css/bootstrap.min.css');
drupal_add_css(path_to_theme() . '/css/print.css', array('media' => 'print'));
/**
* Add Javascript for enable/disable scrollTop action
*/
if (theme_get_setting('scrolltop_display', 'bootstrap_business')) {
drupal_add_js('jQuery(document).ready(function($) {
$(window).scroll(function() {
if($(this).scrollTop() != 0) {
$("#toTop").fadeIn();
} else {
$("#toTop").fadeOut();
}
});
$("#toTop").click(function() {
$("body,html").animate({scrollTop:0},800);
});
});', array('type' => 'inline', 'scope' => 'header'));
}
if (arg(0) == 'employers' && arg(1) == "") {
$variables['classes_array'][] = 'companies';
}
//EOF:Javascript
}
示例7: template_render
/**
* Render a template.
* @param $name The template name.
* @param $vars An array mapping template variable names to their values. If
* the value is a string, it will be treated as a path.
*/
function template_render($name, $vars = array())
{
// Run default preprocess hook
$vars = array_merge($vars, template_preprocess($vars));
// TODO run module preprocess hooks
// Run default preprocess hook for template
$generator = 'template_preprocess_' . $name;
if (function_exists($generator)) {
$vars = array_merge($vars, call_user_func($generator, $vars));
}
// TODO run page-specific module preprocess hooks
extract($vars);
// Render template
if (isset($vars['type'])) {
$filename = path_to_theme() . '/' . "{$name}-{$vars['type']}" . '.tpl.php';
} else {
// TODO This should be a fallback, not an else -Ed 2013-01-29
$filename = path_to_theme() . '/' . $name . '.tpl.php';
}
ob_start();
include $filename;
$output = ob_get_contents();
ob_end_clean();
return $output;
}
示例8: seven_preprocess_page
/**
* Override or insert variables into the page template.
*/
function seven_preprocess_page(&$vars)
{
$vars['primary_local_tasks'] = menu_primary_local_tasks();
$vars['secondary_local_tasks'] = menu_secondary_local_tasks();
$vars['ie_styles'] = '<!--[if lt IE 7]><style type="text/css" media="screen">@import ' . path_to_theme() . '/ie6.css";</style><![endif]-->';
$vars['back_to_site'] = l(t('Back to the front page'), '');
}
示例9: velocity_preprocess_html
function velocity_preprocess_html(&$vars)
{
$file = 'color-' . theme_get_setting('theme_color') . '-style.css';
drupal_add_css(path_to_theme() . '/css/' . $file, array('group' => CSS_THEME, 'weight' => 115, 'browsers' => array(), 'preprocess' => FALSE));
$file = theme_get_setting('theme_layout') . '-style.css';
drupal_add_css(path_to_theme() . '/css/' . $file, array('group' => CSS_THEME, 'weight' => 116, 'browsers' => array(), 'preprocess' => FALSE));
drupal_add_js('jQuery(document).ready(function($) {
$(window).scroll(function() {
if($(this).scrollTop() != 0) {
$("#toTop").fadeIn();
} else {
$("#toTop").fadeOut();
}
});
$("#toTop").click(function() {
$("body,html").animate({scrollTop:0},800);
});
});', array('type' => 'inline', 'scope' => 'header'));
drupal_add_library('system', 'ui.accordion');
drupal_add_library('system', 'ui.tabs');
drupal_add_library('system', 'ui.progressbar');
drupal_add_js(drupal_get_path('module', 'your_module_name') . '/exposedfilterquick.js', 'module');
}
示例10: eu_projects_theme_preprocess_page
/**
* Implements hook_preprocess_page().
*/
function eu_projects_theme_preprocess_page(&$vars, $hook)
{
$path_alias = drupal_get_path_alias();
// Webtools.
$inline_script = '<script defer src="//europa.eu/webtools/load.js" type="text/javascript"></script>';
$element = array('#type' => 'markup', '#markup' => $inline_script);
drupal_add_html_head($element, 'webtools');
// Apple-touch-icon-precomposed.
$apple_touch_icon_precomposed = array('#tag' => 'link', '#attributes' => array('href' => file_create_url(path_to_theme() . '/images/apple-touch-icon.png'), 'rel' => 'apple-touch-icon-precomposed'));
drupal_add_html_head($apple_touch_icon_precomposed, 'apple-touch-icon-precomposed');
// Apple-touch-icon.
$apple_touch_icon = array('#tag' => 'link', '#attributes' => array('href' => file_create_url(path_to_theme() . '/images/apple-touch-icon.png'), 'rel' => 'icon'));
drupal_add_html_head($apple_touch_icon, 'apple-touch-icon');
// Apple-mobile-web-app-capable.
$apple_mobile_web_app_capable = array('#tag' => 'meta', '#attributes' => array('name' => 'apple-mobile-web-app-capable', 'content' => 'yes'));
drupal_add_html_head($apple_mobile_web_app_capable, 'apple-mobile-web-app-capable');
// Application-name.
$application_name = array('#tag' => 'meta', '#attributes' => array('name' => 'application-name', 'content' => t('EU Results')));
drupal_add_html_head($application_name, 'application-name');
// Apple-mobile-web-app-title.
$apple_mobile_web_app_title = array('#tag' => 'meta', '#attributes' => array('name' => 'apple-mobile-web-app-title', 'content' => t('EU Results')));
drupal_add_html_head($apple_mobile_web_app_title, 'apple-mobile-web-app-title');
// Apple-touch-startup-image-ec.
$apple_touch_startup_image_ec = array('#tag' => 'meta', '#attributes' => array('rel' => 'apple-touch-startup-image-ec', 'href' => file_create_url(path_to_theme() . '/images/startup-image.png')));
drupal_add_html_head($apple_touch_startup_image_ec, 'apple-touch-startup-image-ec');
// Preload geojson for map
if ($path_alias == 'search-projects') {
$path = explode('?', request_uri());
$var = isset($path[1]) ? '?' . $path[1] : '';
$preload_geojson = array('#tag' => 'link', '#attributes' => array('rel' => 'prefetch', 'href' => $GLOBALS['base_url'] . '/projects-geojson_' . $GLOBALS['language']->language . $var));
drupal_add_html_head($preload_geojson, 'preload_geojson');
}
}
示例11: cmstheme_preprocess_html
/**
* Implements hook_preproces_html().
*/
function cmstheme_preprocess_html(&$variables)
{
$theme_path = path_to_theme();
drupal_add_js($theme_path . '/js/script.js');
drupal_add_js($theme_path . '/js/jquery.phonenumber.js');
drupal_add_js($theme_path . '/js/jquery.dagsorden.js', array('scope' => 'footer', 'weight' => 5));
}
示例12: corkedscrewer_preprocess_html
/**
* Override or insert variables into the html template.
*/
function corkedscrewer_preprocess_html(&$variables)
{
if (!theme_get_setting('responsive_respond', 'corkedscrewer')) {
drupal_add_css(path_to_theme() . '/css/basic-layout.css', array('group' => CSS_THEME, 'browsers' => array('IE' => '(lte IE 8)&(!IEMobile)', '!IE' => FALSE), 'preprocess' => FALSE));
}
drupal_add_css(path_to_theme() . '/css/ie.css', array('group' => CSS_THEME, 'browsers' => array('!IE' => FALSE), 'preprocess' => FALSE));
}
示例13: bootstrap_business_preprocess_html
/**
* Preprocess variables for html.tpl.php
*/
function bootstrap_business_preprocess_html(&$variables)
{
/**
* Add IE8 Support
*/
drupal_add_css(path_to_theme() . '/css/ie8.css', array('group' => CSS_THEME, 'browsers' => array('IE' => '(lt IE 9)', '!IE' => FALSE), 'preprocess' => FALSE));
/**
* Add Javascript for enable/disable Bootstrap 3 Javascript
*/
if (theme_get_setting('bootstrap_js_include', 'bootstrap_business')) {
drupal_add_js(drupal_get_path('theme', 'bootstrap_business') . '/bootstrap/js/bootstrap.min.js');
}
//EOF:Javascript
/**
* Add Javascript for enable/disable scrollTop action
*/
if (theme_get_setting('scrolltop_display', 'bootstrap_business')) {
drupal_add_js('jQuery(document).ready(function($) {
$(window).scroll(function() {
if($(this).scrollTop() != 0) {
$("#toTop").fadeIn();
} else {
$("#toTop").fadeOut();
}
});
$("#toTop").click(function() {
$("body,html").animate({scrollTop:0},800);
});
});', array('type' => 'inline', 'scope' => 'header'));
}
//EOF:Javascript
}
示例14: theme1014_preprocess
/**
* Implements template_preprocess().
*/
function theme1014_preprocess(&$vars, $hook)
{
$vars['theme1014_path'] = base_path() . path_to_theme();
$count[$hook] = isset($count[$hook]) && is_int($count[$hook]) ? $count[$hook] : 1;
$vars['zebra_hook'][$hook] = $count[$hook] % 2 ? 'odd' : 'even';
$vars['id_hook'][$hook] = $count[$hook]++;
}
示例15: basetpl_process_page
/**
* Implements theme_process_page().
*/
function basetpl_process_page(&$variables)
{
global $base_path;
// show/hide breadcrumb
$variables['show_breadcrumb'] = TRUE;
// var theme_path
$variables['theme_path'] = $base_path . path_to_theme();
// var site_info
$variables['site_info'] = $variables['logo'] || $variables['site_name'] || $variables['site_slogan'] ? TRUE : FALSE;
// check if page is system page
$variables['system_page'] = isset($variables['node']) ? FALSE : TRUE;
// backend
if (user_is_logged_in() && path_is_admin(current_path())) {
$variables['site_info'] = FALSE;
$variables['system_page'] = TRUE;
foreach (element_children($variables['page']) as $region) {
if ($region != 'content') {
$variables['page'][$region] = FALSE;
}
}
}
// show/hide page title
$variables['title'] = $variables['system_page'] ? $variables['title'] : FALSE;
// add robots to head
if (theme_get_setting('robots') == 1) {
$robots = array('#type' => 'html_tag', '#tag' => 'meta', '#attributes' => array('name' => 'robots', 'content' => 'noindex,nofollow'));
drupal_add_html_head($robots, 'robots');
}
}