本文整理汇总了PHP中module_exists函数的典型用法代码示例。如果您正苦于以下问题:PHP module_exists函数的具体用法?PHP module_exists怎么用?PHP module_exists使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了module_exists函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: alterDependencies
/**
* Overrides Drupal\configuration\Config\Configuration::alterDependencies().
*/
public static function alterDependencies(Configuration $config)
{
if ($config->getComponent() == 'content_type') {
$variables = array('field_bundle_settings_node_', 'language_content_type', 'node_options', 'node_preview', 'node_submitted');
if (module_exists('comment')) {
$variables += array('comment', 'comment_anonymous', 'comment_controls', 'comment_default_mode', 'comment_default_order', 'comment_default_per_page', 'comment_form_location', 'comment_preview', 'comment_subject_field');
}
if (module_exists('menu')) {
$variables += array('menu_options', 'menu_parent');
}
$entity_type = $config->getEntityType();
$fields = field_info_instances($entity_type, $config->getIdentifier());
foreach ($variables as $variable) {
$identifier = $variable . '_' . $config->getIdentifier();
$in_db = db_query("SELECT 1 FROM {variable} WHERE name = :name", array(':name' => $identifier))->fetchField();
// Some variables are not in the database and their values are
// provided by the second paramenter of variable_get.
// Only inform about configurations that are indeed in the database.
if ($in_db) {
$var_config = new VariableConfiguration($identifier);
$var_config->build();
$config->addToDependencies($var_config);
}
}
}
}
示例2: scc_preprocess_region
/**
* @file
* This file is empty by default because the base theme chain (Alpha & Omega) provides
* all the basic functionality. However, in case you wish to customize the output that Drupal
* generates through Alpha & Omega this file is a good place to do so.
*
* Alpha comes with a neat solution for keeping this file as clean as possible while the code
* for your subtheme grows. Please read the README.txt in the /preprocess and /process subfolders
* for more information on this topic.
*/
function scc_preprocess_region(&$vars)
{
$theme = alpha_get_theme();
switch ($vars['elements']['#region']) {
case 'content':
$vars['is_node_page'] = isset($theme->page['node']);
}
if ($vars['region'] == 'menu') {
$main_menu = menu_main_menu();
$secondary_menu = menu_secondary_menu();
if ($main_menu) {
if (module_exists('nice_menus')) {
$vars['primary_nav'] = theme('nice_menus_main_menu');
} else {
$vars['primary_nav'] = theme('links__system_main_menu', array('links' => $main_menu, 'attributes' => array('id' => 'main-menu', 'class' => array('links', 'inline', 'clearfix', 'main-menu')), 'heading' => array('text' => t('Main menu'), 'level' => 'h2', 'class' => array('element-invisible'))));
}
} else {
$vars['primary_nav'] = false;
}
if ($secondary_menu) {
$vars['secondary_nav'] = theme('links__system_secondary_menu', array('links' => $secondary_menu, 'attributes' => array('id' => 'secondary-menu', 'class' => array('links', 'inline', 'clearfix', 'secondary-menu')), 'heading' => array('text' => t('Secondary menu'), 'level' => 'h2', 'class' => array('element-invisible'))));
} else {
$vars['secondary_nav'] = false;
}
}
}
示例3: bootstrap_menu_link
/**
* Overrides theme_menu_link().
*/
function bootstrap_menu_link(array $variables)
{
$element = $variables['element'];
$sub_menu = '';
if ($element['#below']) {
// Prevent dropdown functions from being added to management menu so it
// does not affect the navbar module.
if ($element['#original_link']['menu_name'] == 'management' && module_exists('navbar')) {
$sub_menu = drupal_render($element['#below']);
} elseif (!empty($element['#original_link']['depth']) && $element['#original_link']['depth'] >= 1) {
// Add our own wrapper.
unset($element['#below']['#theme_wrappers']);
$sub_menu = '<ul class="dropdown-menu">' . drupal_render($element['#below']) . '</ul>';
// Generate as standard dropdown.
//$element['#title'] .= ' <span class="caret"></span>';
$element['#attributes']['class'][] = 'dropdown';
$element['#localized_options']['html'] = TRUE;
// Set dropdown trigger element to # to prevent inadvertant page loading
// when a submenu link is clicked.
//$element['#localized_options']['attributes']['data-target'] = '#';
$element['#localized_options']['attributes']['class'][] = 'dropdown-toggle';
//$element['#localized_options']['attributes']['data-toggle'] = 'dropdown';
}
}
// On primary navigation menu, class 'active' is not set on active menu item.
// @see https://drupal.org/node/1896674
if (($element['#href'] == $_GET['q'] || $element['#href'] == '<front>' && drupal_is_front_page()) && empty($element['#localized_options']['language'])) {
$element['#attributes']['class'][] = 'active';
}
$output = l($element['#title'], $element['#href'], $element['#localized_options']);
return '<li' . drupal_attributes($element['#attributes']) . '>' . $output . $sub_menu . "</li>\n";
}
示例4: expandSource
/**
* Expand module source
*
* @param string $source
*
* return string[]
*/
protected final function expandSource($source)
{
if (false === strpos($source, ':')) {
return [$source => $source];
}
$ret = [];
// This is a source from a module
list($module, $target) = explode(':', $source, 2);
if (!module_exists($module)) {
throw new \InvalidArgumentException(sprintf("'%s' module is not enable or does not exist", $module));
}
$list = $this->getModuleList();
if (!isset($list[$module])) {
throw new \InvalidArgumentException(sprintf("'%s' module does not declare any synchronization sources", $module));
}
$targets = [];
// This is valid, user asked module: without any target defined, the
// whole module will be imported
if (empty($target)) {
$targets = $list[$module];
} else {
if (!in_array($target, $list[$module])) {
throw new \InvalidArgumentException(sprintf("'%s' module: '%s' source is not declared", $module, $target));
} else {
$targets = [$target];
}
}
$path = drupal_get_path('module', $module);
foreach ($targets as $target) {
$ret[$module . ':' . $target] = $path . '/' . $target;
}
return $ret;
}
示例5: skeletontheme_process_html
/**
* Override or insert variables into the page template for HTML output.
*/
function skeletontheme_process_html(&$variables)
{
// Hook into color.module.
if (module_exists('color')) {
_color_html_alter($variables);
}
}
示例6: bootstrap_menu_link
/**
* Returns HTML for a menu link and submenu.
*
* @param array $variables
* An associative array containing:
* - element: Structured array data for a menu link.
*
* @return string
* The constructed HTML.
*
* @see theme_menu_link()
*
* @ingroup theme_functions
*/
function bootstrap_menu_link(array $variables)
{
$element = $variables['element'];
$sub_menu = '';
$title = $element['#title'];
$href = $element['#href'];
$options = !empty($element['#localized_options']) ? $element['#localized_options'] : array();
$attributes = !empty($element['#attributes']) ? $element['#attributes'] : array();
if ($element['#below']) {
// Prevent dropdown functions from being added to management menu so it
// does not affect the navbar module.
if ($element['#original_link']['menu_name'] == 'management' && module_exists('navbar')) {
$sub_menu = drupal_render($element['#below']);
} elseif (!empty($element['#original_link']['depth']) && $element['#original_link']['depth'] == 1) {
// Add our own wrapper.
unset($element['#below']['#theme_wrappers']);
$sub_menu = '<ul class="dropdown-menu">' . drupal_render($element['#below']) . '</ul>';
// Generate as standard dropdown.
$title .= ' <span class="caret"></span>';
$attributes['class'][] = 'dropdown';
$options['html'] = TRUE;
// Set dropdown trigger element to # to prevent inadvertant page loading
// when a submenu link is clicked.
$options['attributes']['data-target'] = '#';
$options['attributes']['class'][] = 'dropdown-toggle';
$options['attributes']['data-toggle'] = 'dropdown';
}
}
// Filter the title if the "html" is set, otherwise l() will automatically
// sanitize using check_plain(), so no need to call that here.
if (!empty($options['html'])) {
$title = _bootstrap_filter_xss($title);
}
return '<li' . drupal_attributes($attributes) . '>' . l($title, $href, $options) . $sub_menu . "</li>\n";
}
示例7: cu_omega_form_system_theme_settings_alter
function cu_omega_form_system_theme_settings_alter(&$form, &$form_state)
{
$theme = $form_state['build_info']['args'][0];
$form['cu_omega_theme_settings'] = array('#type' => 'fieldset', '#title' => t('Theme Settings'));
$form['cu_omega_theme_settings']['typography'] = array('#type' => 'fieldset', '#title' => t('Typography'), '#collapsible' => TRUE, '#collapsed' => TRUE);
$form['cu_omega_theme_settings']['typography']['headings'] = array('#type' => 'radios', '#title' => t('Heading Style'), '#default_value' => theme_get_setting('headings', $theme) ? theme_get_setting('headings', $theme) : 'headings-bold', '#description' => t('Pick a style for your sites headings.'), '#options' => array('headings-bold' => t('Bold'), 'headings-light' => t('Light')));
if (module_exists('cu_title_image')) {
$form['cu_omega_theme_settings']['page_title_image'] = array('#type' => 'fieldset', '#title' => t('Page Title Image'), '#collapsible' => TRUE, '#collapsed' => TRUE);
$form['cu_omega_theme_settings']['page_title_image']['page_title_image_background'] = array('#type' => 'radios', '#title' => t('Page Title Image Style'), '#default_value' => theme_get_setting('page_title_image_background', $theme) ? theme_get_setting('page_title_image_background', $theme) : 'page-title-image-background-white', '#description' => t('Pick a style for page title image text.'), '#options' => array('page-title-image-background-white' => t('Solid'), 'page-title-image-background-transparent' => t('Transparent')));
$form['cu_omega_theme_settings']['page_title_image']['page_title_image_width'] = array('#type' => 'radios', '#title' => t('Page Title Image Width'), '#default_value' => theme_get_setting('page_title_image_width', $theme) ? theme_get_setting('page_title_image_width', $theme) : 'page-title-image-width-content', '#description' => t('Pick a width for page title image. The effect is more dramatic when the theme layout option is set to wide.'), '#options' => array('page-title-image-width-full' => t('Browser Width'), 'page-title-image-width-content' => t('Content Width')));
}
$form['cu_omega_theme_settings']['columns'] = array('#type' => 'fieldset', '#title' => t('Column Options'), '#collapsible' => TRUE, '#collapsed' => TRUE);
$form['cu_omega_theme_settings']['columns']['after_content_columns'] = array('#type' => 'radios', '#title' => t('After Content Columns'), '#default_value' => theme_get_setting('after_content_columns', $theme) ? theme_get_setting('after_content_columns', $theme) : '3', '#description' => t('Pick how many columns for blocks after the content'), '#options' => array('6' => t('6'), '4' => t('4'), '3' => t('3'), '2' => t('2'), '1' => t('1')));
$form['cu_omega_theme_settings']['columns']['lower_columns'] = array('#type' => 'radios', '#title' => t('After Content 2 Columns'), '#default_value' => theme_get_setting('lower_columns', $theme) ? theme_get_setting('lower_columns', $theme) : '2', '#description' => t('Pick how many columns for blocks in the second after content region'), '#options' => array('6' => t('6'), '4' => t('4'), '3' => t('3'), '2' => t('2'), '1' => t('1')));
$form['cu_omega_theme_settings']['columns']['footer_columns'] = array('#type' => 'radios', '#title' => t('Footer Columns'), '#default_value' => theme_get_setting('footer_columns', $theme) ? theme_get_setting('footer_columns', $theme) : '4', '#description' => t('Pick how many columns for blocks in the footer'), '#options' => array('6' => t('6'), '4' => t('4'), '3' => t('3'), '2' => t('2'), '1' => t('1')));
$form['cu_omega_theme_settings']['breadcrumbs'] = array('#type' => 'fieldset', '#title' => t('Breadcrumbs'), '#collapsible' => TRUE, '#collapsed' => TRUE);
$form['cu_omega_theme_settings']['breadcrumbs']['use_breadcrumbs'] = array('#type' => 'checkbox', '#title' => t('Use Breadcrumbs'), '#default_value' => theme_get_setting('use_breadcrumbs', $theme) ? theme_get_setting('use_breadcrumbs', $theme) : FALSE, '#description' => t('Enable breadcrumb navigation.'));
$form['cu_omega_theme_settings']['action_menu'] = array('#type' => 'fieldset', '#title' => t('Secondary Menu'), '#collapsible' => TRUE, '#collapsed' => TRUE);
$form['cu_omega_theme_settings']['action_menu']['use_action_menu'] = array('#type' => 'checkbox', '#title' => t('Placement'), '#default_value' => theme_get_setting('use_action_menu', $theme) ? theme_get_setting('use_action_menu', $theme) : FALSE, '#description' => t('Place secondary menu as buttons on main navigation bar. Secondary menu label does not display when this option is selected.'));
$form['cu_omega_theme_settings']['action_menu']['action_menu_color'] = array('#type' => 'radios', '#title' => t('Color'), '#default_value' => theme_get_setting('action_menu_color', $theme) ? theme_get_setting('action_menu_color', $theme) : 'action-none', '#description' => t('Pick color for action menu'), '#options' => array('action-blue' => t('Blue'), 'action-gray' => t('Gray'), 'action-gold' => t('Gold'), 'action-none' => t('None (same as main menu navigation)')));
$form['cu_omega_theme_settings']['footer_menu'] = array('#type' => 'fieldset', '#title' => t('Footer Menu'), '#collapsible' => TRUE, '#collapsed' => TRUE);
$form['cu_omega_theme_settings']['footer_menu']['footer_menu_color'] = array('#type' => 'radios', '#title' => t('Color'), '#default_value' => theme_get_setting('footer_menu_color', $theme) ? theme_get_setting('footer_menu_color', $theme) : 'footer-menu-gray', '#description' => t('Pick color for footer menu.'), '#options' => array('footer-menu-gray' => t('Gray'), 'footer-menu-gold' => t('Gold')));
$form['cu_omega_theme_settings']['block_icons'] = array('#type' => 'fieldset', '#title' => t('Block Icons'), '#collapsible' => TRUE, '#collapsed' => TRUE);
$form['cu_omega_theme_settings']['block_icons']['block_icons_color'] = array('#type' => 'radios', '#title' => t('Color'), '#default_value' => theme_get_setting('block_icons_color', $theme) ? theme_get_setting('block_icons_color', $theme) : 'block-icons-inherit', '#description' => t('Pick color for block title icons.'), '#options' => array('block-icons-inherit' => t('Same as block title text'), 'block-icons-gray' => t('Gray'), 'block-icons-gold' => t('Gold')));
}
示例8: bootstrap_status_messages
/**
* Returns HTML for status and/or error messages, grouped by type.
*
* An invisible heading identifies the messages for assistive technology.
* Sighted users see a colored box. See http://www.w3.org/TR/WCAG-TECHS/H69.html
* for info.
*
* @param array $variables
* An associative array containing:
* - display: (optional) Set to 'status' or 'error' to display only messages
* of that type.
*
* @return string
* The constructed HTML.
*
* @see theme_status_messages()
*
* @ingroup theme_functions
*/
function bootstrap_status_messages($variables)
{
$display = $variables['display'];
$output = '';
$status_heading = array('status' => t('Status message'), 'error' => t('Error message'), 'warning' => t('Warning message'), 'info' => t('Informative message'));
// Map Drupal message types to their corresponding Bootstrap classes.
// @see http://twitter.github.com/bootstrap/components.html#alerts
$status_class = array('status' => 'success', 'error' => 'danger', 'warning' => 'warning', 'info' => 'info');
// Retrieve messages.
$message_list = drupal_get_messages($display);
// Allow the disabled_messages module to filter the messages, if enabled.
if (module_exists('disable_messages') && variable_get('disable_messages_enable', '1')) {
$message_list = disable_messages_apply_filters($message_list);
}
foreach ($message_list as $type => $messages) {
$class = isset($status_class[$type]) ? ' alert-' . $status_class[$type] : '';
$output .= "<div class=\"alert alert-block{$class} messages {$type}\">\n";
$output .= " <a class=\"close\" data-dismiss=\"alert\" href=\"#\">×</a>\n";
if (!empty($status_heading[$type])) {
$output .= '<h4 class="element-invisible">' . $status_heading[$type] . "</h4>\n";
}
if (count($messages) > 1) {
$output .= " <ul>\n";
foreach ($messages as $message) {
$output .= ' <li>' . $message . "</li>\n";
}
$output .= " </ul>\n";
} else {
$output .= $messages[0];
}
$output .= "</div>\n";
}
return $output;
}
示例9: stability_process_page
/**
* Implementation of hook_preprocess_page().
*/
function stability_process_page(&$variables)
{
global $user;
$variables['login_account_links'] = '';
if (theme_get_setting('login_account_links') || module_exists('uc_cart')) {
$output = '';
if (theme_get_setting('login_account_links')) {
$output .= '<span class="login">
<i class="fa fa-lock"></i> ' . l($user->uid ? t('My Account') : t('Login'), 'user') . '
</span>';
$output .= $user->uid ? '<span class="logout"><i class="fa fa-sign-out"></i> ' . l(t('Logout'), 'user/logout') . '</span>' : '';
$output .= !$user->uid ? '<span class="register"><i class="fa fa-pencil-square-o"></i>' . t('Not a Member?') . ' ' . l(t('Register'), 'user/register') . '</span>' : '';
}
if (module_exists('uc_cart')) {
$output .= '<span class="cart">
<i class="fa fa-shopping-cart"></i> ' . l(t('Shopping Cart'), 'cart') . '
</span>';
}
$variables['login_account_links'] = '
<div class="header-top-right">
' . $output . '
</div>';
}
$header_top_menu_tree = module_exists('i18n_menu') ? i18n_menu_translated_tree('menu-header-top-menu') : menu_tree('menu-header-top-menu');
$variables['header_top_menu_tree'] = drupal_render($header_top_menu_tree);
// Process Slideshow Sub Header
if (theme_get_setting('sub_header') == 5 || arg(2) == 'sub-header' && arg(3) == '5') {
drupal_add_js(drupal_get_path('theme', 'stability') . '/vendor/jquery.glide.min.js');
}
if (theme_get_setting('retina')) {
drupal_add_js(drupal_get_path('theme', 'stability') . '/vendor/jquery.retina.js');
}
drupal_add_js(array('stability' => array('flickr_id' => theme_get_setting('flickr_id'), 'logo_sticky' => theme_get_setting('logo_sticky'))), 'setting');
}
示例10: mooc_foundation_access_preprocess_page
/**
* Implements template_preprocess_page.
*/
function mooc_foundation_access_preprocess_page(&$variables)
{
// speedreader is enabled
if (module_exists('speedreader')) {
$variables['speedreader'] = TRUE;
}
// mespeak is enabled
if (module_exists('mespeak')) {
$variables['mespeak'] = TRUE;
}
// support for add child page shortcut
$node = menu_get_object();
if ($node && user_access('access printer-friendly version')) {
$variables['tabs_extras'][200][] = '<hr>';
$variables['tabs_extras'][200][] = l(t('Print'), 'book/export/html/' . arg(1));
}
$child_type = variable_get('book_child_type', 'book');
if ($node && !empty($node->book) && (user_access('add content to books') || user_access('administer book outlines')) && node_access('create', $child_type) && $node->status == 1 && isset($node->book['depth']) && $node->book['depth'] < MENU_MAX_DEPTH) {
$variables['tabs_extras'][200][] = '<hr>';
$variables['tabs_extras'][200][] = l(t('Add child page'), 'node/add/' . str_replace('_', '-', $child_type), array('query' => array('parent' => $node->book['mlid'])));
}
if (user_access('access contextual links')) {
$variables['tabs_extras'][0][] = '<li class="cis_accessibility_check"></li>';
}
}
示例11: overviewForm
public function overviewForm($form, &$form_state)
{
// Add table and pager.
$form = parent::overviewForm($form, $form_state);
// Allow modules to insert their own action links to the 'table', like cleanup module.
$top_actions = module_invoke_all('workflow_operations', 'top_actions', NULL);
// Allow modules to insert their own workflow operations.
foreach ($form['table']['#rows'] as &$row) {
$url = $row[0]['data']['#url'];
$workflow = $url['options']['entity'];
foreach ($actions = module_invoke_all('workflow_operations', 'workflow', $workflow) as $action) {
$action['attributes'] = isset($action['attributes']) ? $action['attributes'] : array();
$row[] = l(strtolower($action['title']), $action['href'], $action['attributes']);
}
}
// @todo: add these top actions next to the core 'Add workflow' action.
$top_actions_args = array('links' => $top_actions, 'attributes' => array('class' => array('inline', 'action-links')));
$form['action-links'] = array('#type' => 'markup', '#markup' => theme('links', $top_actions_args), '#weight' => -1);
if (module_exists('workflownode')) {
// Append the type_map form, changing the form by reference.
// The 'type_map' form is only valid for Workflow Node API.
module_load_include('inc', 'workflow_admin_ui', 'workflow_admin_ui.page.type_map');
workflow_admin_ui_type_map_form($form);
}
// Add a submit button. The submit functions are added in the sub-forms.
$form['submit'] = array('#type' => 'submit', '#value' => t('Save'), '#weight' => 100);
return $form;
}
示例12: osha_configure_solr
/**
* Configure the apachesolr and search_api_solr modules with proper settings.
*/
function osha_configure_solr()
{
$config_file = sprintf('%s/../conf/config.json', dirname(__FILE__));
if (!is_readable($config_file)) {
drupal_set_message("Cannot read configuration file!", 'warning');
return;
}
$cfg = json_decode(file_get_contents($config_file), TRUE);
if (empty($cfg)) {
drupal_set_message('Configuration file was empty, nothing to do here', 'warning');
return;
}
$cfg = array_merge(array('name' => 'Solr server', 'enabled' => 1, 'description' => 'Search server', 'scheme' => 'http', 'host' => 'localhost', 'port' => '8983', 'path' => '/solr', 'http_user' => '', 'http_password' => '', 'excerpt' => NULL, 'retrieve_data' => NULL, 'highlight_data' => NULL, 'skip_schema_check' => NULL, 'solr_version' => '', 'http_method' => 'AUTO'), $cfg['solr_server']);
if (module_exists('search_api_solr') && module_load_include('inc', 'search_api', 'search_api.admin')) {
drupal_set_message('Configuring search_api_solr ...');
$form_state = array('values' => array('machine_name' => 'solr_server', 'class' => 'search_api_solr_service', 'name' => $cfg['name'], 'enabled' => $cfg['enabled'], 'description' => $cfg['description'], 'options' => array('form' => array('scheme' => $cfg['scheme'], 'host' => $cfg['host'], 'port' => $cfg['port'], 'path' => $cfg['path'], 'http' => array('http_user' => $cfg['http_user'], 'http_pass' => $cfg['http_pass']), 'advanced' => array('excerpt' => $cfg['excerpt'], 'retrieve_data' => $cfg['retrieve_data'], 'highlight_data' => $cfg['highlight_data'], 'skip_schema_check' => $cfg['skip_schema_check'], 'solr_version' => $cfg['solr_version'], 'http_method' => $cfg['http_method'])))));
drupal_form_submit('search_api_admin_add_server', $form_state);
}
// Configure apachesolr: submit apachesolr_environment_edit_form
if (module_exists('apachesolr') && module_load_include('inc', 'apachesolr', 'apachesolr.admin')) {
drupal_set_message('Configuring apachesolr ...');
$url = sprintf('%s://%s:%s%s', $cfg['scheme'], $cfg['host'], $cfg['port'], $cfg['path']);
$env_id = apachesolr_default_environment();
$environment = apachesolr_environment_load($env_id);
$environment['url'] = $url;
$environment['name'] = $cfg['name'];
$environment['conf']['apachesolr_direct_commit'] = $cfg['apachesolr_direct_commit'];
$environment['conf']['apachesolr_read_only'] = $cfg['apachesolr_read_only'];
$environment['conf']['apachesolr_soft_commit'] = $cfg['apachesolr_soft_commit'];
apachesolr_environment_save($environment);
// @todo: See ticket #2527 - cannot make the form save new settings!
// drupal_form_submit('apachesolr_environment_edit_form', $form_state,
// $environment);
}
}
示例13: isActive
/**
* Overrides Drupal\configuration\Config\Configuration::isActive().
*/
public static function isActive()
{
if (module_exists('entity')) {
return TRUE;
}
return FALSE;
}
示例14: glisseo_preprocess_node
/**
* Implements template_preprocess_node().
*/
function glisseo_preprocess_node(&$variables)
{
// New classes. More clear then defaults.
$variables['clean_classes_array'] = array();
$variables['clean_classes_array'][] = drupal_html_class($variables['type']);
$variables['clean_classes_array'][] = drupal_html_class($variables['view_mode']);
// We add 'teaser' class, if content is teaser and don't have 'teaser' vew mode.
if ($variables['teaser'] && !in_array('teaser', $variables['clean_classes_array'])) {
$variables['clean_classes_array'][] = drupal_html_class('teaser');
}
// If content is sticky, we add special class.
if ($variables['sticky']) {
$variables['clean_classes_array'][] = drupal_html_class('sticky');
}
// We add that class only when contextual links enabled.
if (module_exists('contextual')) {
$variables['clean_classes_array'][] = drupal_html_class('contextual-links-region');
}
// Generate clean classes variable.
$variables['clean_classes'] = implode(' ', $variables['clean_classes_array']);
// Work with Node object.
$node = $variables['node'];
// Save field values to variables.
foreach ($node as $label => $data) {
// Is label is field.
if (preg_match("/field_(.*)?/i", $label, $matches)) {
$variables[$label] = field_get_items('node', $node, $label);
}
}
}
示例15: omega_alpha_preprocess_html
/**
* Implements hook_preprocess_html().
*/
function omega_alpha_preprocess_html(&$vars)
{
$theme = alpha_get_theme();
$vars['rdf'] = new stdClass();
if (module_exists('rdf')) {
$vars['doctype'] = '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML+RDFa 1.1//EN">' . "\n";
$vars['rdf']->version = ' version="HTML+RDFa 1.1"';
$vars['rdf']->namespaces = $vars['rdf_namespaces'];
$vars['rdf']->profile = ' profile="' . $vars['grddl_profile'] . '"';
} else {
$vars['doctype'] = '<!DOCTYPE html>' . "\n";
$vars['rdf']->version = '';
$vars['rdf']->namespaces = '';
$vars['rdf']->profile = '';
}
if (alpha_library_active('omega_mediaqueries')) {
$layouts = array();
if (isset($theme->grids[$theme->settings['grid']])) {
foreach ($theme->grids[$theme->settings['grid']]['layouts'] as $layout) {
if ($layout['enabled']) {
$layouts[$layout['layout']] = $layout['media'];
}
}
drupal_add_js(array('omega' => array('layouts' => array('primary' => $theme->grids[$theme->settings['grid']]['primary'], 'order' => array_keys($layouts), 'queries' => $layouts))), 'setting');
}
}
}