/** * page alter */ function construction_page_alter(&$vars) { // Add custom varibales for scss $theme = superhero_get_theme(); $theme->custom['header_height'] = theme_get_setting('superhero_header_height'); $theme->custom['header_fixed_height'] = theme_get_setting('superhero_header_fixed_height'); // Remove content from front page if (drupal_is_front_page()) { unset($vars['data']['content']); } }
/** * Implements hook_form_system_theme_settings_alter() */ function superhero_form_system_theme_settings_alter(&$form, &$form_state, $form_id = NULL) { $theme = superhero_get_theme(); $theme_name = $theme->theme; drupal_add_library('system', 'ui.sortable'); if (isset($form_id)) { return; } // Check if Superhero Theme module exists if not, dont allow access to tools if (!module_exists('superhero_theme')) { drupal_set_message(t('Please make sure you install the Superhero Theme. This module is required to manage theme settings'), 'warning'); return; } $superhero_logo = drupal_get_path('theme', 'superhero') . '/images/logo.png'; $form['superhero_logo'] = array('#prefix' => '<div id="framework-logo">', '#markup' => theme('image', array('path' => $superhero_logo)), '#suffix' => '</div>', '#weight' => -9); // Main Settings $form['superhero_settings'] = array('#type' => 'vertical_tabs', '#title' => t('Theme Settings'), '#weight' => -8); superhero_theme_settings_layout($form, $form_state); superhero_theme_settings_sections($form, $form_state); superhero_theme_settings_basic($form, $form_state); //superhero_theme_settings_color($form,$form_state); superhero_theme_settings_preset($form, $form_state); // Drupal Core Settings $form['superhero_settings']['drupal_settings'] = array('#type' => 'fieldset', '#title' => t('Drupal Core')); $form['superhero_settings']['drupal_settings']['theme_settings'] = $form['theme_settings']; $form['superhero_settings']['drupal_settings']['logo'] = $form['logo']; $form['superhero_settings']['drupal_settings']['favicon'] = $form['favicon']; unset($form['theme_settings']); unset($form['logo']); unset($form['favicon']); $theme_path = drupal_get_path('theme', 'superhero'); $bootstrap_path = $theme_path . '/vendor/bootstrap'; $fontawesome_path = $theme_path . '/vendor/font-awesome'; $form['#attached'] = array('css' => array($bootstrap_path . '/css/bootstrap.min.css', $fontawesome_path . '/css/font-awesome.min.css', $theme_path . '/vendor/minicolors/jquery.minicolors.css', $theme_path . '/css/theme_admin.css'), 'js' => array($theme_path . '/js/superhero-admin.js', $bootstrap_path . '/js/bootstrap.min.js', $theme_path . '/vendor/minicolors/jquery.minicolors.min.js')); $form['#theme_object'] = $theme; $form['scss_css'] = array('#type' => 'hidden', '#default_value' => theme_get_setting('scss_css')); $form['#submit'][] = 'superhero_form_system_theme_settings_alter_submit'; }
/** * Implements hook_page_alter */ function superhero_page_alter(&$vars) { $theme = superhero_get_theme(); $data = array(); foreach ($theme->regions as $region => $item) { if ($item['enabled'] && $theme->sections[$item['section']]['enabled'] && ($item['force'] || !empty($vars[$region]))) { $data['data'][$item['section']][$region] = !empty($vars[$region]) ? $vars[$region] : array(); $data['data'][$item['section']][$region]['#weight'] = (int) $item['weight']; $data['data'][$item['section']][$region]['#data'] = $item; if (empty($vars[$region])) { $data['data'][$item['section']][$region]['#region'] = $region; $data['data'][$item['section']][$region]['#theme_wrappers'] = array('region'); } } elseif (!empty($vars[$region])) { $vars['#excluded'][$region] = !empty($vars[$region]) ? $vars[$region] : array(); $vars['#excluded'][$region]['#weight'] = (int) $item['weight']; $vars['#excluded'][$region]['#data'] = $item; } unset($vars[$region]); } foreach ($theme->sections as $section => $item) { if ($item['enabled'] && !empty($data['data'][$item['section']])) { if (isset($item['primary']) && isset($data['data'][$section][$item['primary']])) { superhero_calculate_primary($data['data'][$section], $item['primary']); } $data['data'][$section]['#theme_wrappers'] = array('section'); $data['data'][$section]['#section'] = $section; $data['data'][$section]['#weight'] = (int) $item['weight']; $data['data'][$section]['#data'] = $item; } } $vars = array_merge($vars, $data); }