Setup custom front pages for your site.
'); case 'admin/settings/front/arrange': return t('Arrange the order in which roles will be checked for custom front page settings. Roles will be processed from top to bottom. To enable other roles you must first enable them in the !link.
', array('!link' => l(t('Settings tab'), 'admin/settings/front/settings'))); case 'admin/settings/front/home-links': return t('If a HOME link is set, the <front> placeholder will be replaced with this value instead of the standard front page.
'); } } /** * Implementation of hook_menu(). */ function front_page_menu() { $items['admin/settings/front'] = array( 'title' => t('Front Page'), 'description' => 'Specify a unique layout or splash page based on role type - override your HOME and breadcrumb links - display a custom mission style notice for users who haven\'t visited in a while - disable site and display a \'temporarily offline\' message.', 'page callback' => 'drupal_get_form', 'page arguments' => array('front_page_admin'), 'access arguments' => array('administer front page'), 'file' => 'front_page.admin.inc', ); $items['admin/settings/front/settings'] = array( 'title' => t('Settings'), 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => 0, ); $items['admin/settings/front/arrange'] = array( 'title' => 'Arrange', 'description' => 'Ability to re-arrange what order front page roles are processed.', 'page callback' => 'drupal_get_form', 'page arguments' => array('front_page_admin_arrange_form'), 'access arguments' => array('administer front page'), 'type' => MENU_LOCAL_TASK, 'file' => 'front_page.admin.inc', 'weight' => 1, ); $items['admin/settings/front/home-links'] = array( 'title' => 'Home Links', 'description' => 'Ability to re-write the home links on the site to another local path.', 'page callback' => 'drupal_get_form', 'page arguments' => array('front_page_admin_home_links'), 'access arguments' => array('administer front page'), 'type' => MENU_LOCAL_TASK, 'file' => 'front_page.admin.inc', 'weight' => 2, ); $items['front_page'] = array( 'title' => '', 'page callback' => 'front_page', 'access callback' => TRUE, 'type' => MENU_SUGGESTED_ITEM, ); $items['front_page/preview/%'] = array( 'title' => '', 'page callback' => 'front_page', 'access callback' => TRUE, 'type' => MENU_SUGGESTED_ITEM, ); return $items; } /** * Implementation of hook_perm(). */ function front_page_perm() { return array('administer front page'); } /** * Implementation of hook_init(). */ function front_page_init() { global $_front_page, $conf; // If this function is called by PHP CLI (drush), do not do anything. if (function_exists('drush_main')) { return; } // let administrator know that there is a config error. if (variable_get('site_frontpage', '') == 'front_page' && user_access('administer menu')) { drupal_set_message(t('There is a configuration error. The home page should not be set to the path "front_page". Please change this !link', array('!link' => l(t('here'), 'admin/settings/site-information'))), 'error'); } if (variable_get('front_page_enable', 0) && drupal_is_front_page()) { $_front_page = front_page_get_by_role(); } if (user_access('administer menu') && preg_match('@^front_page/preview/([0-9]+)$@', $_GET['q'], $match)) { $_front_page = front_page_get_by_rid($match[1]); } if ($_front_page) { switch ($_front_page['mode']) { case 'themed': case 'full': $_GET['q'] = 'front_page'; // need to set variable site_frontpage to current path so that it thinks it is the front page. $conf['site_frontpage'] = $_GET['q']; break; case 'redirect': $url = front_page_parse_url($_front_page['data']); drupal_goto($url['path'], $url['options']); break; case 'alias': $url = front_page_parse_url($_front_page['data']); $_GET['q'] = drupal_get_normal_path($url['path']); // need to set variable site_frontpage to current path so that it thinks it is the front page. $conf['site_frontpage'] = $_GET['q']; break; } // turn caching off for this page as it is dependant on role. $GLOBALS['conf']['cache'] = FALSE; } } /** * Function to handle the display of the front page themed and full types. */ function front_page() { // $_front_page variable should already have been loaded in front_page_init() function. global $_front_page; if ($_front_page) { switch ($_front_page['mode']) { case 'themed': return check_markup($_front_page['data'], $_front_page['filter_format']); case 'full': print check_markup($_front_page['data'], $_front_page['filter_format']); exit; } } // set page not found as there was no themed or full option set for the front page. drupal_not_found(); exit; } /** * Function to parse a full URL including GET variables and fragment * to an array ready for drupal_goto(), url(), or l() functions. */ function front_page_parse_url($path) { $url['path'] = $path; $url['options'] = array(); if (preg_match('@^(?P