| 1 |
<?php |
<?php |
| 2 |
// $Id: custom_breadcrumbs.install,v 1.2.2.2 2007/08/25 05:55:19 eaton Exp $ |
// $Id$ |
| 3 |
|
|
| 4 |
|
/** |
| 5 |
|
* @file |
| 6 |
|
* Install file for the custom_breadcrumbs module. |
| 7 |
|
*/ |
| 8 |
|
|
| 9 |
/** |
/** |
| 10 |
* Implementation of hook_install(). |
* Implementation of hook_install(). |
| 15 |
|
|
| 16 |
function custom_breadcrumbs_schema() { |
function custom_breadcrumbs_schema() { |
| 17 |
$schema['custom_breadcrumb'] = array( |
$schema['custom_breadcrumb'] = array( |
| 18 |
'description' => t('Stores custom breadcrumb trail overrides.'), |
'description' => 'Stores custom breadcrumb trail overrides.', |
| 19 |
'fields' => array( |
'fields' => array( |
| 20 |
'bid' => array( |
'bid' => array( |
| 21 |
'type' => 'serial', |
'type' => 'serial', |
| 22 |
'unsigned' => TRUE, |
'unsigned' => TRUE, |
| 23 |
'not null' => TRUE, |
'not null' => TRUE, |
| 24 |
'description' => t('Unique identifier for the {custom_breadcrumb}.'), |
'description' => 'Unique identifier for the {custom_breadcrumb}.', |
| 25 |
), |
), |
| 26 |
'titles' => array( |
'titles' => array( |
| 27 |
'type' => 'varchar', |
'type' => 'varchar', |
| 28 |
'length' => 255, |
'length' => 255, |
| 29 |
'not null' => TRUE, |
'not null' => TRUE, |
| 30 |
'default' => '', |
'default' => '', |
| 31 |
'description' => t("A return-delimited list of titles for the breadcrumb links.") |
'description' => 'A return-delimited list of titles for the breadcrumb links.', |
| 32 |
), |
), |
| 33 |
'paths' => array( |
'paths' => array( |
| 34 |
'type' => 'varchar', |
'type' => 'varchar', |
| 35 |
'length' => 255, |
'length' => 255, |
| 36 |
'not null' => FALSE, |
'not null' => FALSE, |
| 37 |
'description' => t("A return-delimited list of url paths for the breadcrumb links."), |
'description' => 'A return-delimited list of url paths for the breadcrumb links.', |
| 38 |
), |
), |
| 39 |
'visibility_php' => array( |
'visibility_php' => array( |
| 40 |
'type' => 'text', |
'type' => 'text', |
| 41 |
'not null' => TRUE, |
'not null' => TRUE, |
| 42 |
'size' => 'medium', |
'size' => 'medium', |
| 43 |
'default' => '', |
'description' => 'An optional PHP snippet to control the {custom_breadcrumb} visibility.', |
|
'description' => t('An optional PHP snippet to control the {custom_breadcrumb} visibility.'), |
|
| 44 |
), |
), |
| 45 |
'node_type' => array( |
'node_type' => array( |
| 46 |
'type' => 'varchar', |
'type' => 'varchar', |
| 47 |
'length' => 64, |
'length' => 64, |
| 48 |
'not null' => FALSE, |
'not null' => FALSE, |
| 49 |
'default' => 'AND', |
'default' => 'AND', |
| 50 |
'description' => t("Node types the {custom_breadcrumb} should apply to."), |
'description' => 'Node types the {custom_breadcrumb} should apply to.', |
| 51 |
), |
), |
| 52 |
), |
), |
| 53 |
'primary key' => array('bid'), |
'primary key' => array('bid'), |
| 101 |
switch ($GLOBALS['db_type']) { |
switch ($GLOBALS['db_type']) { |
| 102 |
case 'mysql': |
case 'mysql': |
| 103 |
case 'mysqli': |
case 'mysqli': |
| 104 |
$ret[] = update_sql("ALTER TABLE {custom_breadcrumb} ADD visibility_php text"); |
$ret[] = update_sql("ALTER TABLE {custom_breadcrumb} ADD visibility_php text NOT NULL default ''"); |
| 105 |
break; |
break; |
| 106 |
case 'pgsql': |
case 'pgsql': |
| 107 |
db_add_column($ret, 'custom_breadcrumb', 'visibility_php', 'text', array('default' => '')); |
db_add_column($ret, 'custom_breadcrumb', 'visibility_php', 'text', array('not null' => TRUE, 'default' => "''")); |
| 108 |
break; |
break; |
| 109 |
} |
} |
| 110 |
return $ret; |
return $ret; |
| 111 |
} |
} |
| 112 |
|
|
| 113 |
|
// Add the menu flag. |
| 114 |
|
function custom_breadcrumbs_update_6001() { |
| 115 |
|
$ret = array(); |
| 116 |
|
db_add_field($ret, 'custom_breadcrumb', 'set_active_menu', array('type' => 'int', 'default' => 1, 'NOT NULL' => TRUE)); |
| 117 |
|
return $ret; |
| 118 |
|
} |
| 119 |
|
|
| 120 |
|
// Remove the menu flag. |
| 121 |
|
function custom_breadcrumbs_update_6101() { |
| 122 |
|
$ret = array(); |
| 123 |
|
db_drop_field($ret, 'custom_breadcrumb', 'set_active_menu'); |
| 124 |
|
return $ret; |
| 125 |
|
} |
| 126 |
|
|
| 127 |
function custom_breadcrumbs_uninstall() { |
function custom_breadcrumbs_uninstall() { |
| 128 |
drupal_uninstall_schema('custom_breadcrumbs'); |
drupal_uninstall_schema('custom_breadcrumbs'); |
| 129 |
} |
} |