示例#1
0
 /**
  * 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
0
/**
 * @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;
        }
    }
}
/**
 * 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";
}
 /**
  * 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
0
/**
 * 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);
    }
}
/**
 * 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";
}
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
0
/**
 * 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=\"#\">&times;</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
0
/**
 * 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
0
/**
 * 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>';
    }
}
 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;
 }
/**
 * 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
0
 /**
  * Overrides Drupal\configuration\Config\Configuration::isActive().
  */
 public static function isActive()
 {
     if (module_exists('entity')) {
         return TRUE;
     }
     return FALSE;
 }
示例#14
0
/**
 * 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
0
/**
 * 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');
        }
    }
}
示例#16
0
/**
 * Override or insert variables into the page template.
 */
function corporateclean_process_page(&$variables)
{
    // Hook into color.module.
    if (module_exists('color')) {
        _color_page_alter($variables);
    }
}
示例#17
0
 /**
  * Apply default NextEuropa configuration to a specific content type.
  *
  * This method is usually called into hook_install().
  *
  * @param string $type
  *    Content type machine name.
  *
  * @see nexteuropa_pages_install()
  */
 public function applyDefaultConfigurationToContentType($type)
 {
     // Replace title field.
     multisite_config_service('title')->replaceTitleField('node', $type, 'title');
     multisite_config_service('entity_translation')->enableEntityTranslation($type);
     // Add Organic Group fields.
     multisite_config_service('og')->createOgGroupAudienceField('node', $type);
     multisite_config_service('og')->createOgContentAccessField('node', $type);
     // Enable Workbench Moderation.
     multisite_config_service('workbench_moderation')->enableWorkbenchModeration($type);
     // Grant OG permissions if NextEuropa Editorial feature is enabled.
     if (module_exists('nexteuropa_editorial')) {
         $og_permissions = array();
         $og_permissions['contributor'] = array('create ' . $type . ' content', 'update own ' . $type . ' content', 'delete own ' . $type . ' content');
         $og_permissions['validator'] = $og_permissions['publisher'] = $og_permissions['administrator member'] = array('create ' . $type . ' content', 'update own ' . $type . ' content', 'delete own ' . $type . ' content', 'update any ' . $type . ' content', 'delete any ' . $type . ' content');
         foreach ($og_permissions as $role => $permissions) {
             multisite_config_service('og')->grantOgPermissions($role, $permissions, 'node', 'editorial_team', 'og');
         }
     }
     // Enable Linkchecker control for "Page" content type.
     multisite_config_service('linkchecker')->enableLinkcheckerForContentType($type);
     // Enable default scheduling options for a specific content type.
     multisite_config_service('scheduler')->enableSchedulerForContentType($type);
     // Set unpublish moderation state to "expired".
     // This call cannot be included in the API method above since it is
     // a configuration specific to NextEuropa .
     variable_set('scheduler_unpublish_moderation_state_' . $type, 'expired');
 }
示例#18
0
function chamfer_process_page(&$variables, $hook)
{
    // Hook into color.module.
    if (module_exists('color')) {
        _color_page_alter($variables);
    }
}
示例#19
0
 /**
  * {@inheritdoc}
  */
 public static function create(ContainerInterface $container, array $configuration, $plugin_id, array $plugin_definition)
 {
     if (module_exists('job_scheduler')) {
         return new static($configuration, $plugin_id, $plugin_definition, $container->get('job_scheduler'));
     }
     return new static($configuration, $plugin_id, $plugin_definition);
 }
 /**
  * Generate a settings form for this handler.
  */
 public function settingsForm($field, $instance)
 {
     $field_name = $field['field_name'];
     $form['action'] = array('#type' => 'select', '#title' => t('Action'), '#options' => array('none' => t('Do nothing'), 'hide' => t('Hide field'), 'disable' => t('Disable field')), '#description' => t('Action to take when prepopulating field with values via URL.'));
     $form['action_on_edit'] = array('#type' => 'checkbox', '#title' => t('Apply action on edit'), '#description' => t('Apply action when editing an existing entity.'), '#states' => array('invisible' => array(':input[name="instance[settings][behaviors][prepopulate][action]"]' => array('value' => 'none'))));
     $form['fallback'] = array('#type' => 'select', '#title' => t('Fallback behaviour'), '#description' => t('Determine what should happen if no values are provided via URL.'), '#options' => array('none' => t('Do nothing'), 'hide' => t('Hide field'), 'form_error' => t('Set form error'), 'redirect' => t('Redirect')));
     // Get list of permissions.
     $perms = array();
     $perms[0] = t('- None -');
     foreach (module_list(FALSE, FALSE, TRUE) as $module) {
         // By keeping them keyed by module we can use optgroups with the
         // 'select' type.
         if ($permissions = module_invoke($module, 'permission')) {
             foreach ($permissions as $id => $permission) {
                 $perms[$module][$id] = strip_tags($permission['title']);
             }
         }
     }
     $form['skip_perm'] = array('#type' => 'select', '#title' => t('Skip access permission'), '#description' => t('Set a permission that will not be affected by the fallback behavior.'), '#options' => $perms);
     $description = t('Determine if values that should be prepopulated should "listen" to the OG-context.');
     if ($disabled = !module_exists('og_context') || !og_is_group_audience_field($field_name)) {
         $description .= '<br / >' . t('Organic groups integration: Enable OG-context and set "Entity selection mode" to "Organic groups" to enable this selection.');
     }
     $form['og_context'] = array('#type' => 'checkbox', '#title' => t('OG context'), '#description' => $description, '#disabled' => $disabled);
     return $form;
 }
示例#21
0
/**
 * Override or insert variables into the page template.
 */
function openchurch_theme_process_page(&$variables)
{
    // Hook into color.module.
    if (module_exists('color')) {
        _color_page_alter($variables);
    }
}
示例#22
0
/**
 * Override or insert variables into the page template.
 */
function sky_process_page(&$vars)
{
    // Hook into the color module.
    if (module_exists('color')) {
        _color_page_alter($vars);
    }
}
/**
 * Add link to view full-sized image in colorbox and add caption
 */
function gettysw_preprocess_field(&$vars, $hook)
{
    foreach ($vars['element']['#items'] as $delta => $item) {
        if (!empty($vars['element'][$delta])) {
            if (module_exists('image_field_caption') && isset($item['image_field_caption'])) {
                $vars['items'][$delta]['caption'] = check_markup($item['image_field_caption']['value'], $item['image_field_caption']['format']);
            }
            if ($vars['element']['#field_name'] == 'field_image' && isset($item['uri']) && module_exists('colorbox') && empty($vars['element']['#object']->is_export)) {
                $vars['items'][$delta]['colorbox_link'] = '<a class="colorbox" href="' . file_create_url($item['uri']) . '">Expand Image</a>';
            }
            if ($vars['element']['#field_name'] == 'field_image_reference_info' && $vars['element']['#view_mode'] == 'full') {
                drupal_add_css(drupal_get_path('module', 'lighttable') . '/lighttable.css');
                $vars['content_attributes_array'] = array('id' => 'lighttable');
                foreach ($vars['items'] as $delta => $item) {
                    $fc_item = reset($vars['items'][$delta]['entity']['field_collection_item']);
                    $image_entity = $fc_item['#entity']->field_image_reference[LANGUAGE_NONE][0]['entity'];
                    $file_nodes = file_usage_list($image_entity);
                    $image_node = node_load(key($file_nodes['file']['node']));
                    $vars['items'][$delta]['entity']['field_collection_item']['title'] = array('#markup' => '<span class="field-title">' . $image_node->title . '</span>', '#weight' => -1);
                    $left = $fc_item['#entity']->field_x_pos[LANGUAGE_NONE][0]['value'];
                    $top = $fc_item['#entity']->field_y_pos[LANGUAGE_NONE][0]['value'];
                    $width = $fc_item['#entity']->field_width[LANGUAGE_NONE][0]['value'];
                    $height = $fc_item['#entity']->field_height[LANGUAGE_NONE][0]['value'];
                    $vars['items'][$delta]['#attributes']['style'] = "position: absolute; top: {$top}px; left: {$left}px; width: {$width}px; height: {$height}px;";
                    $vars['items'][$delta]['#attributes']['class'][] = 'lighttable-image-container';
                }
            }
        }
    }
}
示例#24
0
/**
 * Implements template_process_html().
 */
function typebased_process_html(&$variables)
{
    // Hook into color module
    if (module_exists('color')) {
        _color_html_alter($variables);
    }
}
示例#25
0
function gavias_laikafood_format_comma_field($field_category, $node, $limit = NULL)
{
    if (module_exists('i18n_taxonomy')) {
        $language = i18n_language();
    }
    $category_arr = array();
    $category = '';
    $field = field_get_items('node', $node, $field_category);
    if (!empty($field)) {
        foreach ($field as $item) {
            $term = taxonomy_term_load($item['tid']);
            if ($term) {
                if (module_exists('i18n_taxonomy')) {
                    $term_name = i18n_taxonomy_term_name($term, $language->language);
                    // $term_desc = tagclouds_i18n_taxonomy_term_description($term, $language->language);
                } else {
                    $term_name = $term->name;
                    //$term_desc = $term->description;
                }
                $category_arr[] = l($term_name, 'taxonomy/term/' . $item['tid']);
            }
            if ($limit) {
                if (count($category_arr) == $limit) {
                    $category = implode(', ', $category_arr);
                    return $category;
                }
            }
        }
    }
    $category = implode(', ', $category_arr);
    return $category;
}
示例#26
0
/**
 * Override or insert variables into the html template.
 * @param $vars
 *   An array of variables to pass to the theme template.
 */
function gavias_laikafood_preprocess_html(&$vars)
{
    global $theme, $base_url;
    global $parent_root;
    $skin = theme_get_setting('theme_skin');
    drupal_add_css(drupal_get_path('theme', 'gavias_laikafood') . '/css/' . ($skin ? 'skins/' . $skin . '/' : '') . 'template.css', array('group' => CSS_DEFAULT, 'type' => 'file'));
    drupal_add_css(drupal_get_path('theme', 'gavias_laikafood') . '/css/' . ($skin ? 'skins/' . $skin . '/' : '') . 'bootstrap.css', array('group' => CSS_DEFAULT, 'type' => 'file'));
    if (module_exists('gavias_themer') && theme_get_setting('frontend_panel') == '1' && user_access('gavias_customize_preview')) {
        gavias_load_fontend();
    }
    if (theme_get_setting('enable_custom_style') == 1 && trim(variable_get('gavias_profile'))) {
        drupal_add_css(drupal_get_path('theme', 'gavias_laikafood') . '/customize/save/' . variable_get('gavias_profile') . '.css', array('group' => CSS_DEFAULT, 'type' => 'file'));
    }
    $viewport = array('#type' => 'html_tag', '#tag' => 'meta', '#attributes' => array('name' => 'viewport', 'content' => 'width=device-width, initial-scale=1, maximum-scale=1'), '#weight' => 1);
    drupal_add_html_head($viewport, 'viewport');
    // Add boxed class if layout is set that way.
    if (theme_get_setting('site_layout') == 'boxed') {
        $vars['classes_array'][] = 'boxed';
    }
    if (theme_get_setting('preloader') == '1') {
        $vars['classes_array'][] = 'js-preloader';
    } else {
        $vars['classes_array'][] = 'not-preloader';
    }
}
示例#27
0
/**
 * Override or insert variables into the page template.
 */
function bartik_process_page(&$variables)
{
    // Hook into color.module.
    if (isset($variables['node']->type)) {
        $nodetype = $variables['node']->type;
        $variables['theme_hook_suggestions'][] = 'page__' . $nodetype;
    }
    if (module_exists('color')) {
        _color_page_alter($variables);
    }
    // Always print the site name and slogan, but if they are toggled off, we'll
    // just hide them visually.
    $variables['hide_site_name'] = theme_get_setting('toggle_name') ? FALSE : TRUE;
    $variables['hide_site_slogan'] = theme_get_setting('toggle_slogan') ? FALSE : TRUE;
    if ($variables['hide_site_name']) {
        // If toggle_name is FALSE, the site_name will be empty, so we rebuild it.
        $variables['site_name'] = filter_xss_admin(variable_get('site_name', 'Drupal'));
    }
    if ($variables['hide_site_slogan']) {
        // If toggle_site_slogan is FALSE, the site_slogan will be empty, so we rebuild it.
        $variables['site_slogan'] = filter_xss_admin(variable_get('site_slogan', ''));
    }
    // Since the title and the shortcut link are both block level elements,
    // positioning them next to each other is much simpler with a wrapper div.
    if (!empty($variables['title_suffix']['add_or_remove_shortcut']) && $variables['title']) {
        // Add a wrapper div using the title_prefix and title_suffix render elements.
        $variables['title_prefix']['shortcut_wrapper'] = array('#markup' => '<div class="shortcut-wrapper clearfix">', '#weight' => 100);
        $variables['title_suffix']['shortcut_wrapper'] = array('#markup' => '</div>', '#weight' => -99);
        // Make sure the shortcut link is the first item in title_suffix.
        $variables['title_suffix']['add_or_remove_shortcut']['#weight'] = -100;
    }
}
示例#28
0
文件: template.php 项目: blipp/drupal
/**
 * Override or insert variables into the page template.
 */
function garland_process_page(&$vars)
{
    // Hook into color.module
    if (module_exists('color')) {
        _color_page_alter($vars);
    }
}
示例#29
0
/**
 * Implementation of THEMEHOOK_settings() function.
 *
 * @param $saved_settings
 *   An array of saved settings for this theme.
 * @return
 *   A form array.
 */
function cti_flex_settings($saved_settings)
{
    // Get the default values from the .info file.
    $defaults = zen_theme_get_default_settings('cti_flex');
    // Merge the saved variables and their default values.
    $settings = array_merge($defaults, $saved_settings);
    /*
     * Create the form using Forms API: http://api.drupal.org/api/6
     */
    $form = array();
    $form['cti_flex_fixed'] = array('#type' => 'checkbox', '#title' => t('Use fixed width for theme'), '#default_value' => $settings['cti_flex_fixed'], '#description' => t('The theme will be centered and fixed at 960 pixels wide. If you do not select this, the layout will be fluid, full width.'));
    $form['cti_flex_design'] = array('#type' => 'radios', '#title' => t('Design'), '#default_value' => $settings['cti_flex_design'], '#options' => array('0' => t('Teal and Orange'), '1' => t('Blue and Green'), '2' => t('Red and Gray'), '4' => t('None (plain gray) - Select this option if using the color picker tool below')), '#description' => t('Select the specific site design you would like to use. Each design has its own style sheet in the "colors" directory of the theme.'));
    $form['cti_flex_font_family'] = array('#type' => 'radios', '#title' => t('Font Family'), '#default_value' => $settings['cti_flex_font_family'], '#options' => array('0' => t('None - set manually in stylesheet'), '1' => t('Arial, Helvetica, Bitstream Vera Sans, sans-serif'), '2' => t('Lucida Sans, Verdana, Arial, sans-serif'), '3' => t('Times, Times New Roman, Georgia, Bitstream Vera Serif, serif'), '4' => t('Georgia, Times New Roman, Bitstream Vera Serif, serif'), '5' => t('Verdana, Tahoma, Arial, Helvetica, Bitstream Vera Sans, sans-serif'), '6' => t('Tahoma, Verdana, Arial, Helvetica, Bitstream Vera Sans, sans-serif')), '#description' => t('Select the font family to be used on the site.'));
    $form['cti_flex_color1'] = array('#type' => (module_exists('colorpicker') ? 'colorpicker_' : '') . 'textfield', '#title' => t('Select color for body background (outside of main content area)'), '#default_value' => $settings['cti_flex_color1'], '#description' => t('Click on the eyedropper icon to use color picker.  Or enter an HTML color code.'), '#prefix' => '<fieldset class="collapsible"><legend>Custom color settings</legend><br />These values will override any colors in your style sheets.  Leave blank to use defaults.<br /><b>Important:</b> You must have the <a href="http://drupal.org/project/colorpicker" target="_blank">Color Picker</a> module installed to use the color picker widget.<div style="margin: 20px 0 0 20px;"><b>BACKGROUND COLORS</b>');
    $form['cti_flex_color2'] = array('#type' => (module_exists('colorpicker') ? 'colorpicker_' : '') . 'textfield', '#title' => t('Select color for header and footer backgrounds'), '#default_value' => $settings['cti_flex_color2'], '#description' => t('Click on the eyedropper icon to use color picker.  Or enter an HTML color code.'));
    $form['cti_flex_color3'] = array('#type' => (module_exists('colorpicker') ? 'colorpicker_' : '') . 'textfield', '#title' => t('Select color for main navigation bar and block header backgrounds'), '#default_value' => $settings['cti_flex_color3'], '#description' => t('Click on the eyedropper icon to use color picker.  Or enter an HTML color code.'));
    $form['cti_flex_color4'] = array('#type' => (module_exists('colorpicker') ? 'colorpicker_' : '') . 'textfield', '#title' => t('Select color for block content background'), '#default_value' => $settings['cti_flex_color4'], '#description' => t('Click on the eyedropper icon to use color picker.  Or enter an HTML color code.'));
    $form['cti_flex_color5'] = array('#type' => (module_exists('colorpicker') ? 'colorpicker_' : '') . 'textfield', '#title' => t('Select color for links'), '#default_value' => $settings['cti_flex_color5'], '#description' => t('Click on the eyedropper icon to use color picker.  Or enter an HTML color code.'), '#prefix' => t('<b>TEXT COLORS</b>'));
    $form['cti_flex_color6'] = array('#type' => (module_exists('colorpicker') ? 'colorpicker_' : '') . 'textfield', '#title' => t('Select color for site name, site slogan and footer text'), '#default_value' => $settings['cti_flex_color6'], '#description' => t('Click on the eyedropper icon to use color picker.  Or enter an HTML color code.'));
    $form['cti_flex_color7'] = array('#type' => (module_exists('colorpicker') ? 'colorpicker_' : '') . 'textfield', '#title' => t('Select color for primary menu links and block headers'), '#default_value' => $settings['cti_flex_color7'], '#description' => t('Click on the eyedropper icon to use color picker.  Or enter an HTML color code.'));
    $form['cti_flex_color8'] = array('#type' => (module_exists('colorpicker') ? 'colorpicker_' : '') . 'textfield', '#title' => t('Select color for secondary menu links'), '#default_value' => $settings['cti_flex_color8'], '#description' => t('Click on the eyedropper icon to use color picker.  Or enter an HTML color code.'), '#suffix' => '</div></fieldset>');
    // Add the base theme's settings.
    $form += zen_settings($saved_settings, $defaults);
    // Remove some of the base theme's settings.
    unset($form['themedev']['zen_layout']);
    // We don't need to select the base stylesheet.
    // Return the form
    return $form;
}
 protected function loadFromDb()
 {
     if (module_exists('ctools')) {
         ctools_include('export');
         $result = ctools_export_load_object('ldap_authorization', 'names', array($this->consumerType));
         // @todo, this is technically wrong, but I don't quite grok what we're doing in the non-ctools case - justintime
         $consumer_conf = array_pop($result);
         // There's no ctools api call to get the reserved properties, so instead of hardcoding a list of them
         // here, we just grab everything.  Basically, we sacrifice a few bytes of RAM for forward-compatibility.
     } else {
         $select = db_select('ldap_authorization', 'ldap_authorization');
         $select->fields('ldap_authorization');
         $select->condition('ldap_authorization.consumer_type', $this->consumerType);
         $consumer_conf = $select->execute()->fetchObject();
     }
     if (!$consumer_conf) {
         $this->inDatabase = FALSE;
         return;
     }
     $this->sid = $consumer_conf->sid;
     $this->consumerType = $consumer_conf->consumer_type;
     $this->numericConsumerConfId = isset($consumer_conf->numeric_consumer_conf_id) ? $consumer_conf->numeric_consumer_conf_id : NULL;
     $this->status = $consumer_conf->status ? 1 : 0;
     $this->onlyApplyToLdapAuthenticated = (bool) @$consumer_conf->only_ldap_authenticated;
     $this->useFirstAttrAsGroupId = (bool) @$consumer_conf->useFirstAttrAsGroupId;
     $this->searchAll = (bool) @$consumer_conf->searchAll;
     $this->mappings = $this->pipeListToArray($consumer_conf->mappings, FALSE);
     $this->useMappingsAsFilter = (bool) @$consumer_conf->use_filter;
     $this->synchToLdap = (bool) @$consumer_conf->synch_to_ldap;
     $this->synchOnLogon = (bool) @$consumer_conf->synch_on_logon;
     $this->regrantLdapProvisioned = (bool) @$consumer_conf->regrant_ldap_provisioned;
     $this->revokeLdapProvisioned = (bool) @$consumer_conf->revoke_ldap_provisioned;
     $this->createConsumers = (bool) @$consumer_conf->create_consumers;
     $this->server = ldap_servers_get_servers($this->sid, NULL, TRUE);
 }