Exemplo n.º 1
0
 * - $page: The rendered page content.
 * - $page_bottom: Final closing markup from any modules that have altered the
 *   page. This variable should always be output last, after all other dynamic
 *   content.
 * - $classes String of classes that can be used to style contextually through
 *   CSS.
 *
 * @see template_preprocess()
 * @see template_preprocess_html()
 * @see template_process()
 * @see omega_preprocess_html()
 */
?>
<!DOCTYPE html>
<?php 
if (omega_extension_enabled('compatibility') && omega_theme_get_setting('omega_conditional_classes_html', TRUE)) {
    ?>
  <!--[if IEMobile 7]><html class="no-js ie iem7" lang="<?php 
    print $language->language;
    ?>
" dir="<?php 
    print $language->dir;
    ?>
"><![endif]-->
  <!--[if lte IE 6]><html class="no-js ie lt-ie9 lt-ie8 lt-ie7" lang="<?php 
    print $language->language;
    ?>
" dir="<?php 
    print $language->dir;
    ?>
"><![endif]-->
Exemplo n.º 2
0
/**
 * Helper function for retaining settings of an extension.
 */
function _omega_retain_extension_settings($form, &$form_state, $extension, $theme, $parents = array())
{
    $current = array_merge(array('omega', $extension, 'settings'), $parents);
    if ($items = drupal_array_get_nested_value($form, $current)) {
        foreach (element_children($items) as $key) {
            if (array_key_exists($key, $form_state['values'])) {
                $form_state['values'][$key] = omega_theme_get_setting($key, NULL, $theme);
            }
            $next = array_merge($parents, array($key));
            _omega_retain_extension_settings($form, $form_state, $extension, $theme, $next);
        }
    }
}
Exemplo n.º 3
0
/**
 * Implements hook_page_alter().
 */
function omega_page_alter(&$page)
{
    // Place dummy blocks in each region if the 'demo regions' setting is active
    // to force regions to be rendered.
    if (omega_extension_enabled('development') && omega_theme_get_setting('omega_demo_regions', TRUE) && user_access('administer site configuration')) {
        $item = menu_get_item();
        // Don't interfere with the 'Demonstrate block regions' page.
        if (strpos('admin/structure/block/demo/', $item['path']) !== 0) {
            $regions = system_region_list($GLOBALS['theme_key'], REGIONS_VISIBLE);
            $configured = omega_theme_get_setting('omega_demo_regions_list', array_keys($regions));
            // We don't explicitly load possible layout regions and instead really
            // just show demo regions for those regions that we can actually place
            // blocks in. Hence, there will only be demo regions for those regions
            // that have been declared through the theme's .info file.
            foreach (array_intersect_key($regions, array_flip($configured)) as $region => $name) {
                if (empty($page[$region])) {
                    $page[$region]['#theme_wrappers'] = array('region');
                    $page[$region]['#region'] = $region;
                }
                $page[$region]['#name'] = $name;
                $page[$region]['#debug'] = TRUE;
            }
        }
    }
}
Exemplo n.º 4
0
/**
 * Implements hook_form_FORM_alter().
 */
function pik_form_system_theme_settings_alter(&$form, $form_state)
{
    $form['pik_enable_warning'] = array('#type' => 'checkbox', '#title' => t('Show a warning when this theme is used'), '#description' => t("You can permanently hide this message, but please be aware that pik is a demonstration subtheme and will therefore be constantly evolving with latest best practices. Explore, break it and learn but don't use it in production directly, or as a base theme."), '#default_value' => omega_theme_get_setting('pik_enable_warning', TRUE), '#weight' => -20);
}
Exemplo n.º 5
0
function omega_form_alter(&$form, &$form_state, $form_id) {
  switch ($form_id) {
    // add a login link to the horizontal login bar block
    case 'user_login_block':
      if(omega_theme_get_setting('user_login_form')) {
        $form['links']['#markup'] = "";
        
        $items = array();
        $items[] = l(t('Login'), 'user/login', array('attributes' => array('title' => t('Log in.'), 'class' => 'login-submit-link')));
        if (variable_get('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL)) {
          $items[] = l(t('Register'), 'user/register', array('attributes' => array('title' => t('Create a new user account.'))));
        }
        $items[] = l(t('Password'), 'user/password', array('attributes' => array('title' => t('Request new password via e-mail.'))));
        $form['links']['#markup'] = theme('item_list', array('items' => $items));
      }
    
      // HTML5 placeholder attribute
      $form['name']['#attributes']['placeholder'] = omega_theme_get_setting('user_login_name_placeholder');
      $form['pass']['#attributes']['placeholder'] = omega_theme_get_setting('user_login_pass_placeholder');

      break;
    case 'search_block_form':
      // HTML5 placeholder attribute
      $form['search_block_form']['#attributes']['placeholder'] = omega_theme_get_setting('omega_search_default_text');
      break;
  }
}
Exemplo n.º 6
0
/**
 * Implements hook_omega_theme_libraries_info().
 */
function omega_omega_theme_libraries_info($theme)
{
    $libraries['selectivizr'] = array('name' => t('Selectivizr'), 'description' => t('Selectivizr is a JavaScript utility that emulates CSS3 pseudo-classes and attribute selectors in Internet Explorer 6-8. Simply include the script in your pages and selectivizr will do the rest.'), 'vendor' => 'Keith Clark', 'vendor url' => 'http://selectivizr.com/', 'package' => t('Polyfills'), 'files' => array('js' => array(omega_theme_trail_file('libraries/selectivizr/selectivizr.min.js') => array('browsers' => array('IE' => '(gte IE 6)&(lte IE 8)', '!IE' => FALSE), 'weight' => 110, 'every_page' => TRUE))), 'variants' => array('source' => array('name' => t('Source'), 'description' => t('During development it might be useful to include the source files instead of the minified version.'), 'files' => array('js' => array(omega_theme_trail_file('libraries/selectivizr/selectivizr.js') => array('browsers' => array('IE' => '(gte IE 6)&(lte IE 8)', '!IE' => FALSE), 'weight' => 110, 'every_page' => TRUE))))));
    $libraries['respond'] = array('name' => t('Respond'), 'description' => t('Respond is a fast & lightweight polyfill for min/max-width CSS3 Media Queries (for IE 6-8, and more). Note: This library requires <a href="!url">CSS aggregation</a> to be enabled for it to work properly.', array('!url' => url('admin/config/development/performance', array('alias' => TRUE)))), 'vendor' => 'Scott Jehl', 'vendor url' => 'http://scottjehl.com/', 'package' => t('Polyfills'), 'callbacks' => array('omega_extension_library_requirements_css_aggregation'), 'files' => array('js' => array(omega_theme_trail_file('libraries/respond/respond.min.js') => array('browsers' => array('IE' => '(gte IE 6)&(lte IE 8)', '!IE' => FALSE), 'weight' => 120, 'every_page' => TRUE))), 'variants' => array('source' => array('name' => t('Source'), 'description' => t('During development it might be useful to include the source files instead of the minified version.'), 'files' => array('js' => array(omega_theme_trail_file('libraries/respond/respond.js') => array('browsers' => array('IE' => '(gte IE 6)&(lte IE 8)', '!IE' => FALSE), 'weight' => 120, 'every_page' => TRUE))))));
    $libraries['css3pie'] = array('name' => t('CSS3 PIE'), 'description' => t('PIE makes Internet Explorer 6-9 capable of rendering several of the most useful CSS3 decoration features.'), 'vendor' => 'Keith Clark', 'vendor url' => 'http://css3pie.com/', 'options form' => 'omega_library_pie_options_form', 'package' => t('Polyfills'), 'files' => array(), 'variants' => array('js' => array('name' => t('JavaScript'), 'description' => t('While the .htc behavior is still the recommended approach for most users, the JS version has some advantages that may be a better fit for some users.'), 'files' => array('js' => array(omega_theme_trail_file('libraries/pie/PIE.js') => array('browsers' => array('IE' => '(gte IE 6)&(lte IE 8)', '!IE' => FALSE), 'weight' => 100, 'every_page' => TRUE))))));
    $settings = omega_theme_get_setting('omega_libraries');
    if (!empty($settings['css3pie']['selectors'])) {
        // Add the generated .css file to the corresponding variant.
        $destination = file_create_url('public://omega/' . $theme);
        $destination = substr($destination, strlen($GLOBALS['base_url']) + 1);
        file_prepare_directory($destination, FILE_CREATE_DIRECTORY);
        // Save the generated CSS in the public file system.
        $file = $destination . '/pie-selectors.css';
        $htc = base_path() . omega_theme_trail_file('libraries/pie/PIE.htc');
        $contents = implode(",", $settings['css3pie']['selectors']) . "{behavior:url({$htc})}";
        file_unmanaged_save_data($contents, $file, FILE_EXISTS_REPLACE);
        $libraries['css3pie']['files']['css'][$file] = array('browsers' => array('IE' => '(gte IE 6)&(lte IE 8)', '!IE' => FALSE), 'weight' => 100, 'every_page' => TRUE);
        // Save the generated JS in the public file system.
        $file = $destination . '/pie-selectors.js';
        $contents = '$(function(){Drupal.behaviors.css3pie={attach:function(context,settings){if(window.PIE){$("' . implode(",", $settings['css3pie']['selectors']) . '").each(function(){PIE.attach(this)})}}}})(jQuery);';
        file_unmanaged_save_data($contents, $file, FILE_EXISTS_REPLACE);
        $libraries['css3pie']['variants']['js']['files']['js'][$file] = array('browsers' => array('IE' => '(gte IE 6)&(lte IE 8)', '!IE' => FALSE), 'weight' => 100, 'every_page' => TRUE);
    }
    $libraries['html5shiv'] = array('name' => t('HTML5 Shiv'), 'description' => t('This script is the defacto way to enable use of HTML5 sectioning elements in legacy Internet Explorer, as well as default HTML5 styling in Internet Explorer 6 - 9, Safari 4.x (and iPhone 3.x), and Firefox 3.x.'), 'vendor' => 'Alexander Farkas', 'package' => t('Polyfills'), 'files' => array('js' => array(omega_theme_trail_file('libraries/html5shiv/html5shiv.js') => array('browsers' => array('IE' => '(gte IE 6)&(lte IE 8)', '!IE' => FALSE), 'weight' => 100, 'every_page' => TRUE), omega_theme_trail_file('libraries/html5shiv/html5shiv-printshiv.js') => array('browsers' => array('IE' => '(gte IE 6)&(lte IE 8)', '!IE' => FALSE), 'weight' => 100, 'every_page' => TRUE))), 'variants' => array('source' => array('name' => t('Source'), 'description' => t('During development it might be useful to include the source files instead of the minified version.'), 'files' => array('js' => array(omega_theme_trail_file('libraries/html5shiv/html5shiv.min.js') => array('browsers' => array('IE' => '(gte IE 6)&(lte IE 8)', '!IE' => FALSE), 'weight' => 100, 'every_page' => TRUE), omega_theme_trail_file('libraries/html5shiv/html5shiv-printshiv.min.js') => array('browsers' => array('IE' => '(gte IE 6)&(lte IE 8)', '!IE' => FALSE), 'weight' => 100, 'every_page' => TRUE))))));
    $libraries['messages'] = array('name' => t('Discardable messages'), 'description' => t("Adds a 'close' button to each message."), 'package' => t('Goodies'), 'files' => array('js' => array(omega_theme_trail_file('js/omega.messages.min.js') => array('weight' => -100, 'every_page' => TRUE)), 'css' => array(omega_theme_trail_file('css/omega.messages.css') => array('weight' => -100, 'every_page' => TRUE))));
    return $libraries;
}