/[drupal]/contributions/modules/virtual_site/virtual_site_information.module
ViewVC logotype

Contents of /contributions/modules/virtual_site/virtual_site_information.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.3 - (show annotations) (download) (as text)
Thu Mar 20 11:00:27 2008 UTC (20 months, 1 week ago) by fokke
Branch: MAIN
CVS Tags: DRUPAL-6--1-3, HEAD
Changes since 1.2: +10 -1 lines
File MIME type: text/x-php
- Fixed force base URL (did not work well with subdomains)
- Fixed features to only be called when they are set
- Fixed that frontpage settings was not enforced at all
1 <?php
2 // $Id: virtual_site_information.module,v 1.2 2008/03/08 16:46:38 fokke Exp $
3
4 /**
5 * Implementation of hook_feature_info().
6 */
7 function virtual_site_information_feature_info() {
8 return array(
9 'virtual_site_information_feature' => array(
10 'name' => t('Information'),
11 'description' => t('Set site information settings for your virtual site, like the name and frontpage.'),
12 ),
13 );
14 }
15
16 function virtual_site_information_feature_form($context) {
17 global $conf;
18
19 // Temporarily relace the current settings by the ones of the virtual site.
20 $orig = $conf;
21 $conf = array_merge($conf, (array) $context);
22
23 // Retrieve theme settings form
24 include_once('modules/system/system.admin.inc');
25 $form['settings'] = system_site_information_settings();
26 $form['settings']['#tree'] = TRUE;
27
28 // Restore current settings
29 $conf = $orig;
30
31 // Unset unwanted form parts
32 unset($form['settings']['buttons'], $form['settings']['#submit'], $form['settings']['#theme']);
33
34 return $form;
35 }
36
37 function virtual_site_information_feature_submit($form, &$form_state) {
38 return $form_state['values']['settings'];
39 }
40
41 function virtual_site_information_feature($context) {
42 global $conf;
43
44 if (is_array($context) && count($context)) {
45 $old_front_path = drupal_get_normal_path(variable_get('site_frontpage', 'node'));
46
47 // Overwrite front page
48 if ($context['site_frontpage'] && $old_front_path == $_GET['q'] && $old_front_path != $context['site_frontpage']) {
49 $_GET['q'] = drupal_get_normal_path($context['site_frontpage']);
50 }
51
52 // Others except site object are all just variables
53 unset($context['site']);
54 $conf = array_merge($conf, $context);
55 }
56 }
57
58 ?>

  ViewVC Help
Powered by ViewVC 1.1.2