Пример #1
0
/**
 * Implements theme_menu_link().
 */
function commons_origins_menu_link($vars)
{
    $output = '';
    $path_to_at_core = drupal_get_path('theme', 'adaptivetheme');
    include_once $path_to_at_core . '/inc/get.inc';
    global $theme_key;
    $theme_name = $theme_key;
    $element = $vars['element'];
    commons_origins_menu_link_class($element);
    $sub_menu = '';
    if ($element['#below']) {
        $sub_menu = drupal_render($element['#below']);
    }
    if (at_get_setting('extra_menu_classes', $theme_name) == 1 && !empty($element['#original_link'])) {
        if (!empty($element['#original_link']['depth'])) {
            $element['#attributes']['class'][] = 'menu-depth-' . $element['#original_link']['depth'];
        }
        if (!empty($element['#original_link']['mlid'])) {
            $element['#attributes']['class'][] = 'menu-item-' . $element['#original_link']['mlid'];
        }
    }
    if (at_get_setting('menu_item_span_elements', $theme_name) == 1 && !empty($element['#title'])) {
        $element['#title'] = '<span>' . $element['#title'] . '</span>';
        $element['#localized_options']['html'] = TRUE;
    }
    if (at_get_setting('unset_menu_titles', $theme_name) == 1 && !empty($element['#localized_options']['attributes']['title'])) {
        unset($element['#localized_options']['attributes']['title']);
    }
    $output = l($element['#title'], $element['#href'], $element['#localized_options']);
    return '<li' . drupal_attributes($element['#attributes']) . '>' . $output . $sub_menu . "</li>";
}
Пример #2
0
/**
 * Adds classes to the page element
 */
function os_basetheme_preprocess_page(&$vars)
{
    $item = menu_get_item();
    // Remove the node view tab.
    if (!empty($vars['tabs']['#primary'])) {
        foreach ($vars['tabs']['#primary'] as $k => $l) {
            if ($l['#link']['path'] == 'node/%/view') {
                unset($vars['tabs']['#primary'][$k]);
            }
        }
    }
    //Adds OpenScholar header region awareness to body classes
    $header = array('header-left' => $vars['page']['header_first'], 'header-main' => $vars['page']['header_second'], 'header-right' => $vars['page']['header_third']);
    $content = array('content-top' => $vars['page']['content_top'], 'content-left' => $vars['page']['content_first'], 'content-right' => $vars['page']['content_second'], 'content-bottom' => $vars['page']['content_bottom']);
    $footer = array('footer-left' => $vars['page']['footer_first'], 'footer' => $vars['page']['footer'], 'footer-right' => $vars['page']['footer_third']);
    foreach (array('header', 'content', 'footer') as $var) {
        $visible = array_filter(${$var}, "__os_basetheme_is_empty");
        if (count($visible)) {
            $vars['classes_array'] = array_merge($vars['classes_array'], array_keys($visible));
        } else {
            $vars['classes_array'][] = $var . '-none';
        }
    }
    if (module_exists('overlay') && overlay_get_mode() == 'child') {
        // overlay does this, but adaptive theme renders them in a different way that overlay doesn't expect
        $vars['primary_local_tasks'] = $vars['title'] = false;
    }
    if (!isset($vars['use_content_regions'])) {
        $vars['use_content_regions'] = FALSE;
    }
    // Do not show the login button on the following pages, redundant.
    $login_pages = array('user', 'private_site', 'user/password');
    if (isset($item) && !in_array($item['path'], $login_pages)) {
        $vars['login_link'] = theme('openscholar_login');
    }
    //hide useless tabs - drupal uses $vars['tabs'], but adaptive loads primary and secondary menu local tasks.
    $vars['primary_local_tasks'] = !empty($vars['tabs']['#primary']) ? $vars['tabs']['#primary'] : '';
    $vars['secondary_local_tasks'] = $vars['tabs']['#secondary'];
    $theme_name = $GLOBALS['theme_key'];
    // Adds skip link var to page template
    $vars['skip_link'] = 'main-content';
    if (at_get_setting('skip_link_target', $theme_name)) {
        $skip_link_target = at_get_setting('skip_link_target', $theme_name);
        $vars['skip_link'] = trim(check_plain($skip_link_target), '#');
    }
}
Пример #3
0
/**
 * Override or insert variables into the html template.
 */
function ibm_apim_theme_preprocess_html(&$vars)
{
    global $theme_key;
    $theme_name = $theme_key;
    // Add a class for the active color scheme
    if (module_exists('color')) {
        $class = check_plain(get_color_scheme_name($theme_name));
        $vars['classes_array'][] = 'color-scheme-' . drupal_html_class($class);
    }
    // Add class for the active theme
    $vars['classes_array'][] = drupal_html_class($theme_name);
    // Add theme settings classes
    $settings_array = array('box_shadows', 'body_background', 'menu_bullets', 'menu_bar_position', 'content_corner_radius', 'tabs_corner_radius');
    foreach ($settings_array as $setting) {
        $vars['classes_array'][] = at_get_setting($setting);
    }
}
Пример #4
0
/**
 * Override or insert variables into the html template.
 */
function sky_preprocess_html(&$vars)
{
    global $theme_key;
    $theme_name = $theme_key;
    // Add a class for the active color scheme
    if (module_exists('color') && function_exists('get_color_scheme_name')) {
        $class = check_plain(get_color_scheme_name($theme_name));
        $vars['classes_array'][] = 'color-scheme-' . drupal_html_class($class);
    }
    // Add class for the active theme
    $vars['classes_array'][] = drupal_html_class($theme_name);
    // Browser sniff and add a class, unreliable but quite useful
    // $vars['classes_array'][] = css_browser_selector();
    // Add theme settings classes
    $settings_array = array('box_shadows', 'body_background', 'menu_bullets', 'menu_bar_position', 'content_corner_radius', 'tabs_corner_radius');
    foreach ($settings_array as $setting) {
        $vars['classes_array'][] = at_get_setting($setting);
    }
}
Пример #5
0
/**
 * Implements hook_form_system_theme_settings_alter().
 *
 * @param $form
 *   Nested array of form elements that comprise the form.
 * @param $form_state
 *   A keyed array containing the current state of the form.
 */
function sky_form_system_theme_settings_alter(&$form, &$form_state)
{
    // Include a hidden form field with the current release information
    $form['at-release'] = array('#type' => 'hidden', '#default_value' => '7.x-3.x');
    // Tell the submit function its safe to run the color inc generator
    // if running on AT Core 7.x-3.x
    $form['at-color'] = array('#type' => 'hidden', '#default_value' => TRUE);
    if (at_get_setting('enable_extensions') === 1) {
        $form['at']['corners'] = array('#type' => 'fieldset', '#title' => t('Rounded corners'), '#description' => t('<h3>Rounded Corners</h3><p>Rounded corners are implimented using CSS and only work in modern compliant browsers. You can set the radius for both the main content and main menu tabs.</p>'));
        $form['at']['corners']['content_corner_radius'] = array('#type' => 'select', '#title' => t('Main content radius'), '#default_value' => theme_get_setting('content_corner_radius'), '#description' => t('Change the corner radius for the main content area.'), '#options' => array('rc-0' => t('none'), 'rc-4' => t('4px'), 'rc-6' => t('6px'), 'rc-8' => t('8px'), 'rc-10' => t('10px'), 'rc-12' => t('12px')));
        $form['at']['corners']['tabs_corner_radius'] = array('#type' => 'select', '#title' => t('Menu tabs radius'), '#default_value' => theme_get_setting('tabs_corner_radius'), '#description' => t('Change the corner radius for the main menu tabs.'), '#options' => array('rct-0' => t('none'), 'rct-4' => t('4px'), 'rct-6' => t('6px'), 'rct-8' => t('8px'), 'rct-10' => t('10px'), 'rct-12' => t('12px')));
        $form['at']['pagestyles'] = array('#type' => 'fieldset', '#title' => t('Textures'), '#description' => t('<h3>Textures</h3><p>Textures are small, semi-transparent images that tile to fill the entire page background.</p>'));
        $form['at']['pagestyles']['textures'] = array('#type' => 'fieldset', '#title' => t('Textures'), '#description' => t('<h3>Body Textures</h3><p>This setting adds a texture over the main background color - the darker the background the more these stand out, on light backgrounds the effect is subtle.</p>'));
        $form['at']['pagestyles']['textures']['body_background'] = array('#type' => 'select', '#title' => t('Select texture'), '#default_value' => theme_get_setting('body_background'), '#options' => array('bb-n' => t('None'), 'bb-h' => t('Hatch'), 'bb-vl' => t('Vertical lines'), 'bb-hl' => t('Horizontal lines'), 'bb-g' => t('Grid'), 'bb-d' => t('Dots')));
        $form['at']['menu_styles'] = array('#type' => 'fieldset', '#title' => t('Menu Settings'), '#description' => t('<h3>Menu Bullets</h3><p>Customize the bullet images used on menus items. Bullet images only show on normal vertical block menus.</p>'));
        $form['at']['menu_styles']['menu_bullets'] = array('#type' => 'select', '#title' => t('Menu Bullets'), '#default_value' => theme_get_setting('menu_bullets'), '#options' => array('mb-n' => t('None'), 'mb-dd' => t('Drupal default'), 'mb-ah' => t('Arrow head'), 'mb-ad' => t('Double arrow head'), 'mb-ca' => t('Circle arrow'), 'mb-fa' => t('Fat arrow'), 'mb-sa' => t('Skinny arrow')));
        $form['at']['menu_styles']['mbp'] = array('#type' => 'fieldset', '#title' => t('Menu Bar Alignment'), '#description' => t('<h3>Menu Bar Alignment</h3><p>Position the Menu Bar left, center or right. This will position any menu (Superfish included) placed in the Menu Bar region.</p>'));
        $form['at']['menu_styles']['mbp']['menu_bar_position'] = array('#type' => 'radios', '#title' => t('Set the position of the Menu bar'), '#default_value' => theme_get_setting('menu_bar_position'), '#options' => array('mbp-l' => t('Left (default)'), 'mbp-c' => t('Center'), 'mbp-r' => t('Right')));
    }
}
Пример #6
0
/**
 * Implements hook_form_system_theme_settings_alter().
 *
 * @param $form
 *   Nested array of form elements that comprise the form.
 * @param $form_state
 *   A keyed array containing the current state of the form.
 */
function humblebeggining_form_system_theme_settings_alter(&$form, &$form_state)
{
    // Include a hidden form field with the current release information
    $form['at-release'] = array('#type' => 'hidden', '#default_value' => '7.x-3.x');
    // Tell the submit function its safe to run the color inc generator
    // if running on AT Core 7.x-3.x
    $form['at-color'] = array('#type' => 'hidden', '#default_value' => TRUE);
    if (at_get_setting('enable_extensions') === 1) {
        $form['at']['corners'] = array('#type' => 'fieldset', '#title' => t('Rounded corners'), '#description' => t('<h3>Rounded Corners</h3><p>Rounded corners are implimented using CSS and only work in modern compliant browsers. You can set the radius for both the main content and main menu tabs.</p>'));
        $form['at']['corners']['content_corner_radius'] = array('#type' => 'select', '#title' => t('Main content radius'), '#default_value' => theme_get_setting('content_corner_radius'), '#description' => t('Change the corner radius for the main content area.'), '#options' => array('rc-0' => t('none'), 'rc-4' => t('4px'), 'rc-6' => t('6px'), 'rc-8' => t('8px'), 'rc-10' => t('10px'), 'rc-12' => t('12px')));
        $form['at']['corners']['tabs_corner_radius'] = array('#type' => 'select', '#title' => t('Menu tabs radius'), '#default_value' => theme_get_setting('tabs_corner_radius'), '#description' => t('Change the corner radius for the main menu tabs.'), '#options' => array('rct-0' => t('none'), 'rct-4' => t('4px'), 'rct-6' => t('6px'), 'rct-8' => t('8px'), 'rct-10' => t('10px'), 'rct-12' => t('12px')));
        $form['at']['pagestyles'] = array('#type' => 'fieldset', '#title' => t('Box Shadows and Textures'), '#description' => t('<h3>Shadows and Textures</h3><p>The box shadows are implimented using CSS and only work in modern compliant browsers. The textures are small, semi-transparent images that tile to fill the entire background.</p>'));
        $form['at']['pagestyles']['shadows'] = array('#type' => 'fieldset', '#title' => t('Box Shadows'), '#description' => t('<h3>Box Shadows</h3><p>Box shadows (a drop shadow/glow effect) apply to the main content column and work only in CSS3 compliant browsers such as Firefox, Safari and Chrome.</p>'));
        $form['at']['pagestyles']['shadows']['box_shadows'] = array('#type' => 'radios', '#title' => t('<strong>Apply a box shadow to the main content column</strong>'), '#default_value' => theme_get_setting('box_shadows'), '#options' => array('bs-n' => t('None'), 'bs-l' => t('Box shadow - light'), 'bs-d' => t('Box shadow - dark')));
        $form['at']['pagestyles']['textures'] = array('#type' => 'fieldset', '#title' => t('Textures'), '#description' => t('<h3>Body Textures</h3><p>This setting adds a texture over the main background color - the darker the background the more these stand out, on light backgrounds the effect is subtle.</p>'));
        $form['at']['pagestyles']['textures']['body_background'] = array('#type' => 'select', '#title' => t('Select texture'), '#default_value' => theme_get_setting('body_background'), '#options' => array('bb-n' => t('None'), 'bb-h' => t('Hatch'), 'bb-vl' => t('Vertical lines'), 'bb-hl' => t('Horizontal lines'), 'bb-g' => t('Grid'), 'bb-d' => t('Dots')));
        $form['at']['menu_styles'] = array('#type' => 'fieldset', '#title' => t('Menu Bullets'), '#description' => t('<h3>Menu Bullets</h3><p>This setting allows you to customize the bullet images used on menus items. Bullet images only show on normal vertical block menus.</p>'));
        $form['at']['menu_styles']['menu_bullets'] = array('#type' => 'select', '#title' => t('Menu Bullets'), '#default_value' => theme_get_setting('menu_bullets'), '#options' => array('mb-n' => t('None'), 'mb-dd' => t('Drupal default'), 'mb-ah' => t('Arrow head'), 'mb-ad' => t('Double arrow head'), 'mb-ca' => t('Circle arrow'), 'mb-fa' => t('Fat arrow'), 'mb-sa' => t('Skinny arrow')));
    }
}
/**
 * @file
 * Implimentation of hook_form_system_theme_settings_alter()
 *
 * To use replace "wetkit_adaptivetheme" with your themeName and uncomment by
 * deleting the comment line to enable.
 *
 * @param $form: Nested array of form elements that comprise the form.
 * @param $form_state: A keyed array containing the current state of the form.
 */
function wetkit_adaptivetheme_form_system_theme_settings_alter(&$form, &$form_state)
{
    // Your knarly custom theme settings go here...
    if (isset($form_id)) {
        return;
    }
    // Create the form using Forms API: http://api.drupal.org/api/7
    $form['at-settings']['wetkit_overrides'] = array('#type' => 'fieldset', '#title' => t('WetKit Overrides'));
    $form['at-settings']['wetkit_overrides']['render_mb_main_link'] = array('#type' => 'checkbox', '#title' => t('Disable rendering of the mb main link inside the mega menu'), '#default_value' => at_get_setting('render_mb_main_link'), '#description' => t('Specify whether or not the mega menu should include the main link.'));
    $form['at-settings']['wetkit_overrides']['render_nolink'] = array('#type' => 'checkbox', '#title' => t('Disable rendering of menu items with <nolink> as path'), '#default_value' => at_get_setting('render_nolink'), '#description' => t('Specify whether or not menu links with <nolink> as path should render an a href. (This can break certain versions of WET)'));
    $form['at-settings']['wetkit_overrides']['alternate_site_url'] = array('#type' => 'textfield', '#title' => t('Alternate Site URL'), '#default_value' => at_get_setting('alternate_site_url'), '#description' => t('Alternate Site URL to be used with Site Name.'));
    $form['at-settings']['wetkit_overrides']['wetkit_sub_site'] = array('#type' => 'textfield', '#title' => t('Intranet web site name'), '#default_value' => at_get_setting('wetkit_sub_site'), '#description' => t('The display name for the Intranet web site'));
    $form['at-settings']['wetkit_overrides']['search_indexing_start'] = array('#type' => 'textfield', '#title' => t('Start Indexing tag for search'), '#default_value' => at_get_setting('search_indexing_start'), '#description' => t('Custom Markup to wrap around content to assist in indexing.'));
    $form['at-settings']['wetkit_overrides']['search_indexing_stop'] = array('#type' => 'textfield', '#title' => t('Stop Indexing tag for search'), '#default_value' => at_get_setting('search_indexing_stop'), '#description' => t('Custom Markup to wrap around content to assist in indexing.'));
    $form['at-settings']['accessibility'] = array('#type' => 'fieldset', '#title' => t('Accessibility Settings'));
    $form['at-settings']['accessibility']['skip_link_content_anchor'] = array('#type' => 'textfield', '#title' => t('Anchor ID for the “skip link” 1'), '#default_value' => at_get_setting('skip_link_content_anchor'), '#field_prefix' => '#', '#description' => t('Specify the HTML ID of the element that the accessible-but-hidden “skip link” should link to. (<a href="!link">Read more about skip links</a>.)', array('!link' => 'http://drupal.org/node/467976')));
    $form['at-settings']['accessibility']['skip_link_text'] = array('#type' => 'textfield', '#title' => t('Text for the “skip link” 1'), '#default_value' => t('Skip to main content'), '#description' => t('For example: <em>Jump to navigation</em>, <em>Skip to content</em>'));
    $form['at-settings']['accessibility']['skip_link_nav_anchor'] = array('#type' => 'textfield', '#title' => t('Anchor ID for the “skip link” 2'), '#default_value' => at_get_setting('skip_link_nav_anchor'), '#field_prefix' => '#', '#description' => t('Specify the HTML ID of the element that the accessible-but-hidden “skip link” should link to. (<a href="!link">Read more about skip links</a>.)', array('!link' => 'http://drupal.org/node/467976')));
    $form['at-settings']['accessibility']['skip_link2_text'] = array('#type' => 'textfield', '#title' => t('Text for the “skip link” 2'), '#default_value' => t('Skip to footer'), '#description' => t('For example: <em>Jump to navigation</em>, <em>Skip to content</em>'));
    // We are editing the $form in place, so we don't need to return anything.
}
/**
 * Implements hook_form_system_theme_settings_alter().
 *
 * @param $form
 *   Nested array of form elements that comprise the form.
 * @param $form_state
 *   A keyed array containing the current state of the form.
 */
function pixture_reloaded_form_system_theme_settings_alter(&$form, &$form_state)
{
    // Include a hidden form field with the current release information
    $form['at-release'] = array('#type' => 'hidden', '#default_value' => '7.x-3.x');
    // Remove option to use full width wrappers
    $form['at']['modify-output']['design']['page_full_width_wrappers'] = array('#access' => FALSE);
    // Tell the submit function its safe to run the color inc generator
    // if running on AT Core 7.x-3.x
    $form['at-color'] = array('#type' => 'hidden', '#default_value' => TRUE);
    if (at_get_setting('enable_extensions') === 1) {
        $form['at']['corners'] = array('#type' => 'fieldset', '#title' => t('Rounded corners'));
        $form['at']['corners']['corner_radius'] = array('#type' => 'select', '#title' => t('Corner radius'), '#default_value' => theme_get_setting('corner_radius'), '#description' => t('Change the corner radius for blocks, node teasers and comments.'), '#options' => array('rc-0' => t('none'), 'rc-4' => t('4px'), 'rc-8' => t('8px'), 'rc-12' => t('12px')));
        $form['at']['pagestyles'] = array('#type' => 'fieldset', '#title' => t('Box Shadows and Textures'), '#description' => t('<h3>Shadows and Textures</h3><p>The box shadows are implimented using CSS and only work in modern compliant browsers. The textures are small, semi-transparent images that tile to fill the entire background.</p>'));
        $form['at']['pagestyles']['shadows'] = array('#type' => 'fieldset', '#title' => t('Box Shadows'), '#description' => t('<h3>Box Shadows</h3><p>Box shadows (a drop shadow/glow effect) apply to the main content column and work only in CSS3 compliant browsers such as Firefox, Safari and Chrome.</p>'));
        $form['at']['pagestyles']['shadows']['box_shadows'] = array('#type' => 'radios', '#title' => t('<strong>Apply a box shadow to the main content column</strong>'), '#default_value' => theme_get_setting('box_shadows'), '#options' => array('bs-n' => t('None'), 'bs-l' => t('Box shadow - light'), 'bs-d' => t('Box shadow - dark')));
        $form['at']['pagestyles']['textures'] = array('#type' => 'fieldset', '#title' => t('Textures'), '#description' => t('<h3>Body Textures</h3><p>This setting adds a texture over the main background color - the darker the background the more these stand out, on light backgrounds the effect is subtle.</p>'));
        $form['at']['pagestyles']['textures']['body_background'] = array('#type' => 'select', '#title' => t('Select texture'), '#default_value' => theme_get_setting('body_background'), '#options' => array('bb-n' => t('None'), 'bb-h' => t('Hatch'), 'bb-vl' => t('Vertical lines'), 'bb-hl' => t('Horizontal lines'), 'bb-g' => t('Grid'), 'bb-d' => t('Dots')));
        $form['at']['menus'] = array('#type' => 'fieldset', '#title' => t('Menu Settings'));
        $form['at']['menus']['mbp'] = array('#type' => 'fieldset', '#title' => t('Menu Bar Alignment'), '#description' => t('<h3>Menu Bar Alignment</h3><p>Position the Menu Bar left, center or right. This will position any menu (Superfish included) placed in the Menu Bar region.</p>'));
        $form['at']['menus']['mbp']['menu_bar_position'] = array('#type' => 'radios', '#title' => t('Set the position of the Menu bar'), '#default_value' => theme_get_setting('menu_bar_position'), '#options' => array('mbp-l' => t('Left (default)'), 'mbp-c' => t('Center'), 'mbp-r' => t('Right')));
        $form['at']['menus']['mb'] = array('#type' => 'fieldset', '#title' => t('Menu Bullets'), '#description' => t('<h3>Menu Bullets</h3><p>This setting allows you to customize the bullet images used on menus items. Bullet images only show on normal vertical block menus.</p>'));
        $form['at']['menus']['mb']['menu_bullets'] = array('#type' => 'select', '#title' => t('Menu Bullets'), '#default_value' => theme_get_setting('menu_bullets'), '#options' => array('mb-n' => t('None'), 'mb-dd' => t('Drupal default'), 'mb-ah' => t('Arrow head'), 'mb-ad' => t('Double arrow head'), 'mb-ca' => t('Circle arrow'), 'mb-fa' => t('Fat arrow'), 'mb-sa' => t('Skinny arrow')));
    }
}
/**
 * Override or insert variables into the field template.
 */
function at_commerce_preprocess_field(&$vars)
{
    // Vars and settings for the slideshow, we theme this directly in the field template
    $vars['show_slideshow_caption'] = FALSE;
    if (at_get_setting('show_slideshow_caption') == TRUE) {
        $vars['show_slideshow_caption'] = TRUE;
    }
}
/**
 * @file
 * Implimentation of hook_form_system_theme_settings_alter()
 *
 * @param $form: Nested array of form elements that comprise the form.
 * @param $form_state: A keyed array containing the current state of the form.
 */
function adaptivetheme_form_system_theme_settings_alter(&$form, &$form_state, $form_id = NULL)
{
    // Get our plugin system functions.
    require_once drupal_get_path('theme', 'adaptivetheme') . '/inc/plugins.inc';
    // We need some getters.
    require_once drupal_get_path('theme', 'adaptivetheme') . '/inc/get.inc';
    $path_to_at_core = drupal_get_path('theme', 'adaptivetheme');
    // General "alters" use a form id. Settings should not be set here. The only
    // thing useful about this is if you need to alter the form for the running
    // theme and *not* the theme setting.
    // @see http://drupal.org/node/943212
    if (isset($form_id)) {
        return;
    }
    // Get the active theme name, we need it at some stage.
    $theme_name = $form_state['build_info']['args'][0];
    // Get the active themes info array
    $info_array = at_get_info($theme_name);
    // Version messages
    if (at_get_setting('atcore_version_test', $theme_name) === 1) {
        $legacy_info = at_get_info($theme_name);
        // Nag users of legacy sub-themes...
        if (!isset($legacy_info['release']) || $legacy_info['release'] === '7.x-2.x') {
            $version_message = t('<p>The version of your theme (@theme) is not designed to run on <a href="!link_project" target="_blank">Adaptivetheme 7.x.3.x</a>. It will probably run, but your experience will not be optimal. You have three courses of action to choose from:</p>', array('!link_project' => 'http://drupal.org/project/adaptivetheme', '@theme' => $theme_name));
            $version_message .= t('<ol><li>Downgrade Adaptivetheme to 7.x-2.x</li><li>Upgrade your theme to the 7.x-3.x branch&thinsp;&mdash;&thinsp;you will need to check if an upgrade exists.</li><li>Add the line <code>"release = 7.x-3.x"</code> (less quotes) to your sub-themes info file and clear the cache to make this message go away.</li></ol>');
            $version_message .= t('<p>You can turn off this message in the Debug settings, look for "Sub-theme compatibility test".</p>');
            drupal_set_message(filter_xss_admin($version_message), 'warning');
        }
        // Celebrate the nouveau intelligentsia...
        if (isset($legacy_info['release']) && $legacy_info['release'] === '7.x-3.x') {
            $version_message = t('<p>This theme (@theme) is compatible with <a href="!link_project" target="_blank">Adaptivetheme 7.x.3.x</a>. You are good to go! You can turn off this message in the Debug settings, look for "Sub-theme compatibility test".</p>', array('!link_project' => 'http://drupal.org/project/adaptivetheme', '@theme' => $theme_name));
            drupal_set_message(filter_xss_admin($version_message), 'status');
        }
    }
    // Get the admin theme so we can set a class for styling this form,
    // variable_get() returns 0 if the admin theme is the default theme.
    $admin_theme = variable_get('admin_theme') ? variable_get('admin_theme') : $theme_name;
    $admin_theme_class = 'admin-theme-' . drupal_html_class($admin_theme);
    // LAYOUT SETTINGS
    // Build a custom header for the layout settings form.
    $logo = file_create_url(drupal_get_path('theme', 'adaptivetheme') . '/logo.png');
    $layout_header = '<div class="at-settings-form layout-settings-form ' . $admin_theme_class . '"><div class="layout-header theme-settings-header clearfix">';
    $layout_header .= '<h1>' . t('Layout &amp; General Settings') . '</h1>';
    $layout_header .= '<p class="docs-link"><a href="http://adaptivethemes.com/documentation/adaptivetheme-7x-3x" title="View online documentation" target="_blank">View online documentation</a></p>';
    $layout_header .= '<p class="logo-link"><a href="http://adaptivethemes.com" title="Adaptivethemes.com - Rocking the hardest since 2006" target="_blank"><img class="at-logo" src="' . $logo . '" /></a></p>';
    $layout_header .= '</div>';
    $form['at-settings'] = array('#type' => 'vertical_tabs', '#description' => t('Layout'), '#prefix' => $layout_header, '#suffix' => '</div>', '#weight' => -10, '#attached' => array('css' => array(drupal_get_path('theme', 'adaptivetheme') . '/css/at.settings.form.css')));
    // Include all the default settings forms.
    require_once $path_to_at_core . '/inc/forms/settings.pagelayout.inc';
    at_core_page_layout_form($form, $theme_name);
    require_once $path_to_at_core . '/inc/forms/settings.responsivepanels.inc';
    at_core_responsive_panels_form($form, $theme_name);
    require_once $path_to_at_core . '/inc/forms/settings.global.inc';
    at_core_global_form($form, $theme_name);
    require_once $path_to_at_core . '/inc/forms/settings.polyfills.inc';
    at_core_polyfills_form($form, $theme_name);
    require_once $path_to_at_core . '/inc/forms/settings.metatags.inc';
    at_core_metatags_form($form);
    require_once $path_to_at_core . '/inc/forms/settings.debug.inc';
    at_core_debug_form($form);
    require_once $path_to_at_core . '/inc/forms/settings.extensions.inc';
    at_core_extensions_form($form);
    // EXTENSIONS
    $enable_extensions = isset($form_state['values']['enable_extensions']);
    if ($enable_extensions && $form_state['values']['enable_extensions'] == 1 || !$enable_extensions && $form['at-settings']['extend']['enable_extensions']['#default_value'] == 1) {
        // Build a custom header for the Extensions settings form.
        $styles_header = '<div class="at-settings-form style-settings-form ' . $admin_theme_class . '"><div class="styles-header theme-settings-header clearfix">';
        $styles_header .= '<h1>' . t('Extensions') . '</h1>';
        $styles_header .= '<p class="docs-link"><a href="http://adaptivethemes.com/documentation/extensions" title="View online documentation for Extensions" target="_blank">View online documentation</a></p>';
        $styles_header .= '</div>';
        $form['at'] = array('#type' => 'vertical_tabs', '#weight' => -9, '#prefix' => $styles_header, '#suffix' => '</div>');
        // Include fonts.inc by default, the conditional logic to wrap around this is
        // too hairy to even comtemplate.
        require_once $path_to_at_core . '/inc/fonts.inc';
        // Fonts
        $enable_font_settings = isset($form_state['values']['enable_font_settings']);
        if ($enable_font_settings && $form_state['values']['enable_font_settings'] == 1 || !$enable_font_settings && $form['at-settings']['extend']['enable']['enable_font_settings']['#default_value'] == 1) {
            require_once $path_to_at_core . '/inc/forms/settings.fonts.inc';
            at_core_fonts_form($form);
        }
        // Heading styles
        $enable_heading_settings = isset($form_state['values']['enable_heading_settings']);
        if ($enable_heading_settings && $form_state['values']['enable_heading_settings'] == 1 || !$enable_heading_settings && $form['at-settings']['extend']['enable']['enable_heading_settings']['#default_value'] == 1) {
            require_once $path_to_at_core . '/inc/forms/settings.headings.inc';
            at_core_headings_form($form);
        }
        // Image alignment
        $enable_image_settings = isset($form_state['values']['enable_image_settings']);
        if ($enable_image_settings && $form_state['values']['enable_image_settings'] == 1 || !$enable_image_settings && $form['at-settings']['extend']['enable']['enable_image_settings']['#default_value'] == 1) {
            require_once $path_to_at_core . '/inc/forms/settings.images.inc';
            at_core_images_form($form);
        }
        // Exclude CSS
        $enable_exclude_css = isset($form_state['values']['enable_exclude_css']);
        if ($enable_exclude_css && $form_state['values']['enable_exclude_css'] == 1 || !$enable_exclude_css && $form['at-settings']['extend']['enable']['enable_exclude_css']['#default_value'] == 1) {
            require_once $path_to_at_core . '/inc/forms/settings.cssexclude.inc';
            at_core_css_exclude_form($form, $theme_name);
        }
        // Touch icons
        $enable_apple_touch_icons = isset($form_state['values']['enable_apple_touch_icons']);
        if ($enable_apple_touch_icons && $form_state['values']['enable_apple_touch_icons'] == 1 || !$enable_apple_touch_icons && $form['at-settings']['extend']['enable']['enable_apple_touch_icons']['#default_value'] == 1) {
            require_once $path_to_at_core . '/inc/forms/settings.touchicons.inc';
            at_core_touch_icons_form($form, $theme_name);
        }
        // Custom CSS
        $enable_custom_css = isset($form_state['values']['enable_custom_css']);
        if ($enable_custom_css && $form_state['values']['enable_custom_css'] == 1 || !$enable_custom_css && $form['at-settings']['extend']['enable']['enable_custom_css']['#default_value'] == 1) {
            require_once $path_to_at_core . '/inc/forms/settings.customcss.inc';
            at_core_custom_css_form($form);
        }
        // Mobile regions and blocks
        $enable_context_regions = isset($form_state['values']['enable_context_regions']);
        if ($enable_context_regions && $form_state['values']['enable_context_regions'] == 1 || !$enable_context_regions && $form['at-settings']['extend']['enable']['enable_context_regions']['#default_value'] == 1) {
            require_once $path_to_at_core . '/inc/forms/settings.contextregions.inc';
            at_core_context_regions_form($form, $info_array);
        }
        // Float Region blocks
        $enable_float_region_blocks = isset($form_state['values']['enable_float_region_blocks']);
        if ($enable_float_region_blocks && $form_state['values']['enable_float_region_blocks'] == 1 || !$enable_float_region_blocks && $form['at-settings']['extend']['enable']['enable_float_region_blocks']['#default_value'] == 1) {
            require_once $path_to_at_core . '/inc/forms/settings.floatregionblocks.inc';
            at_core_float_region_blocks_form($form, $info_array);
        }
        // Modify output
        $enable_markup_overides = isset($form_state['values']['enable_markup_overides']);
        if ($enable_markup_overides && $form_state['values']['enable_markup_overides'] == 1 || !$enable_markup_overides && $form['at-settings']['extend']['enable']['enable_markup_overides']['#default_value'] == 1) {
            require_once $path_to_at_core . '/inc/forms/settings.modifyoutput.inc';
            at_core_modify_output_form($form);
        }
    }
    // Include a hidden form field with the current release information
    $form['at-release']['at_core'] = array('#type' => 'hidden', '#default_value' => '7.x-3.x');
    // Collapse annoying forms
    $form['theme_settings']['#collapsible'] = TRUE;
    $form['theme_settings']['#collapsed'] = TRUE;
    $form['logo']['#collapsible'] = TRUE;
    $form['logo']['#collapsed'] = TRUE;
    $form['favicon']['#collapsible'] = TRUE;
    $form['favicon']['#collapsed'] = TRUE;
    /**
     * Originally posted by dvessel (http://drupal.org/user/56782).
     * The following will be processed even if the theme is inactive.
     * If you are on a theme specific settings page but it is not an active
     * theme (example.com/admin/apearance/settings/THEME_NAME), it will
     * still be processed.
     *
     * Build a list of themes related to the theme specific form. If the form
     * is specific to a sub-theme, all parent themes leading to it will have
     * hook_form_theme_settings invoked. For example, if a theme named
     * 'grandchild' has its settings form in focus, the following will be invoked.
     * - parent_form_theme_settings()
     * - child_form_theme_settings()
     * - grandchild_form_theme_settings()
     *
     * If 'child' was in focus it will invoke:
     * - parent_form_theme_settings()
     * - child_form_theme_settings()
     *
     *  @see http://drupal.org/node/943212
     */
    $form_themes = array();
    $themes = list_themes();
    $_theme = $GLOBALS['theme_key'];
    while (isset($_theme)) {
        $form_themes[$_theme] = $_theme;
        $_theme = isset($themes[$_theme]->base_theme) ? $themes[$_theme]->base_theme : NULL;
    }
    $form_themes = array_reverse($form_themes);
    foreach ($form_themes as $theme_key) {
        if (function_exists($form_settings = "{$theme_key}_form_theme_settings")) {
            $form_settings($form, $form_state);
        }
    }
    // Include custom form validation and submit functions
    require_once drupal_get_path('theme', 'adaptivetheme') . '/inc/forms/at_core.validate.inc';
    require_once drupal_get_path('theme', 'adaptivetheme') . '/inc/forms/at_core.submit.inc';
    // Custom validate and submit functions
    $form['#validate'][] = 'at_core_settings_validate';
    $form['#submit'][] = 'at_core_settings_submit';
}
Пример #11
0
function adaptivetheme_subtheme_menu_link__menu_block__1(array $vars)
{
    global $theme_key;
    $theme_name = $theme_key;
    $element = $vars['element'];
    $sub_menu = '';
    /*
     * Dalia's code to display image with menu link in menu block
     */
    if (isset($element['#localized_options']['content']['image'])) {
        $fId = $element['#localized_options']['content']['image'];
        $imageInfo = file_load($fId);
        $imagePath = image_style_url('thumbnail', $imageInfo->uri);
    }
    if ($element['#below']) {
        $sub_menu = drupal_render($element['#below']);
    }
    if (at_get_setting('extra_menu_classes', $theme_name) == 1 && !empty($element['#original_link'])) {
        if (!empty($element['#original_link']['depth'])) {
            $element['#attributes']['class'][] = 'menu-depth-' . $element['#original_link']['depth'];
        }
        if (!empty($element['#original_link']['mlid'])) {
            $element['#attributes']['class'][] = 'menu-item-' . $element['#original_link']['mlid'];
        }
    }
    if (at_get_setting('menu_item_span_elements', $theme_name) == 1 && !empty($element['#title'])) {
        $element['#title'] = '<span>' . $element['#title'] . '</span>';
        $element['#localized_options']['html'] = TRUE;
    }
    if (at_get_setting('unset_menu_titles', $theme_name) == 1) {
        unset($element['#localized_options']['attributes']['title']);
    }
    // Possible feature to show menu descriptions in span elements
    //if ($element['#original_link']['menu_name'] == "main-menu" && isset($element['#localized_options']['attributes']['title'])){
    //  $element['#title'] = '<span class="title">' . $element['#title'] . '</span>';
    //  $element['#title'] .= '<span class="description">' . $element['#localized_options']['attributes']['title'] . '</span>';
    //  $element['#localized_options']['html'] = TRUE;
    //}
    $output = l($element['#title'], $element['#href'], $element['#localized_options']);
    if (isset($imagePath)) {
        return '<li' . drupal_attributes($element['#attributes']) . '><img src=' . $imagePath . '/>' . $output . $sub_menu . "</li>";
    } else {
        return '<li' . drupal_attributes($element['#attributes']) . '>' . $output . $sub_menu . "</li>";
    }
}
Пример #12
0
/**
 * Preprocess Pane Header
 */
function at_gotr_preprocess_pane_header(&$vars)
{
    global $theme_key;
    $theme_name = $theme_key;
    // Set up logo element
    if (at_get_setting('toggle_logo', $theme_name) === 1) {
        $vars['site_logo'] = drupal_static('adaptivetheme_preprocess_page_site_logo');
        if (empty($vars['site_logo'])) {
            $logo_path = check_url($vars['logo']);
            $logo_alt = check_plain(variable_get('site_name', t('Site logo')));
            $logo_vars = array('path' => $logo_path, 'alt' => $logo_alt, 'attributes' => array('class' => 'site-logo'));
            $logo_img = theme('image', $logo_vars);
            $vars['site_logo'] = $logo_img ? l($logo_img, '<front>', array('attributes' => array('title' => t('Home page')), 'html' => TRUE)) : '';
        }
        // Maintain backwards compatibility with 7.x-2.x sub-themes
        $vars['logo_img'] = isset($logo_img) ? $logo_img : '';
        $vars['linked_site_logo'] = $vars['site_logo'];
    } else {
        $vars['site_logo'] = '';
        $vars['logo_img'] = '';
        $vars['linked_site_logo'] = '';
    }
    // Site name
    $vars['site_name'] =& drupal_static('adaptivetheme_preprocess_page_site_name');
    if (empty($vars['site_name'])) {
        $sitename = variable_get('site_name', 'Drupal');
        $vars['site_name'] = l("<strong>GiantGoat</strong><br />Web Development", '<front>', array('attributes' => array('title' => t('Home page')), 'html' => TRUE));
        $vars['site_name_unlinked'] = $sitename;
    }
    // Site name visibility and other classes
    $vars['site_name_attributes_array'] = array();
    $vars['visibility'] = '';
    $vars['hide_site_name'] = FALSE;
    if (at_get_setting('toggle_name', $theme_name) === 0) {
        // Keep the visibility variable to maintain backwards compatibility
        $vars['visibility'] = 'element-invisible';
        $vars['site_name_attributes_array']['class'][] = $vars['visibility'];
        $vars['hide_site_name'] = TRUE;
    }
    // hgroup attributes
    $vars['hgroup_attributes_array'] = array();
    if (!$vars['site_slogan'] && $vars['hide_site_name']) {
        $vars['hgroup_attributes_array']['class'][] = $vars['visibility'];
    }
}