/[drupal]/contributions/modules/custom_links/custom_links.install
ViewVC logotype

Contents of /contributions/modules/custom_links/custom_links.install

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


Revision 1.2 - (show annotations) (download) (as text)
Sun Jan 27 09:16:01 2008 UTC (21 months, 4 weeks ago) by eaton
Branch: MAIN
CVS Tags: DRUPAL-6--1-4, HEAD
Branch point for: DRUPAL-6--1
Changes since 1.1: +98 -27 lines
File MIME type: text/x-php
A straight port of Custom Links to Drupal 6. No new functionality, but full of Sixy goodness.
1 <?php
2 // $Id: custom_links.install,v 1.1.4.1 2007/02/28 08:32:54 eaton Exp $
3
4 /**
5 * Implementation of hook_install().
6 */
7 function custom_links_install() {
8 drupal_install_schema('custom_links');
9 }
10
11 function custom_links_schema() {
12 $schema['custom_link'] = array(
13 'description' => t('Stores custom links to be added to nodes.'),
14 'fields' => array(
15 'lid' => array(
16 'type' => 'serial',
17 'unsigned' => TRUE,
18 'not null' => TRUE,
19 'description' => t('Unique identifier for the {custom_link}.'),
20 ),
21 'link_key' => array(
22 'type' => 'varchar',
23 'length' => 64,
24 'not null' => TRUE,
25 'default' => '',
26 'description' => t("A unique CSS class for the link.")
27 ),
28 'node_type' => array(
29 'type' => 'varchar',
30 'length' => 64,
31 'not null' => TRUE,
32 'default' => '',
33 'description' => t("The node type the {custom_link} should be associated with.")
34 ),
35 'title' => array(
36 'type' => 'varchar',
37 'length' => 255,
38 'not null' => TRUE,
39 'default' => '',
40 'description' => t("The visible title of the {custom_link}.")
41 ),
42 'path' => array(
43 'type' => 'varchar',
44 'length' => 255,
45 'not null' => FALSE,
46 'description' => t("The URL path of the {custom_link}."),
47 ),
48 'viewer_perm' => array(
49 'type' => 'varchar',
50 'length' => 64,
51 'not null' => FALSE,
52 'default' => '',
53 'description' => t("A role that the viewer must have for the link to be displayed.")
54 ),
55 'author_perm' => array(
56 'type' => 'varchar',
57 'length' => 64,
58 'not null' => FALSE,
59 'default' => '',
60 'description' => t("A role that the author must have for the link to be displayed.")
61 ),
62 'check_html' => array(
63 'type' => 'int',
64 'not null' => TRUE,
65 'size' => 'small',
66 'default' => 1,
67 'description' => t('A boolean flag indicating whether the title field contains raw HTML.'),
68 ),
69 'display' => array(
70 'type' => 'int',
71 'not null' => TRUE,
72 'size' => 'small',
73 'default' => 2,
74 'description' => t('An integer indicating what contexts the link should display in.'),
75 ),
76 'query' => array(
77 'type' => 'varchar',
78 'length' => 255,
79 'not null' => FALSE,
80 'default' => 'AND',
81 'description' => t("An optional querystring to be appended to the URL path."),
82 ),
83 'fragment' => array(
84 'type' => 'varchar',
85 'length' => 255,
86 'not null' => FALSE,
87 'default' => 'AND',
88 'description' => t("An optional anchor fragment to be appended to the URL path."),
89 ),
90 ),
91 'primary key' => array('lid'),
92 );
93 return $schema;
94 }
95
96 function custom_links_update_1() {
97 $ret = array();
98 switch ($GLOBALS['db_type']) {
99 case 'mysql':
100 case 'mysqli':
101 $ret[] = update_sql("ALTER TABLE {custom_link} ADD fragment varchar(255)");
102 $ret[] = update_sql("ALTER TABLE {custom_link} ADD query varchar(255)");
103 break;
104 case 'pgsql':
105 db_add_column($ret, 'custom_link', 'fragment', 'varchar', array('default' => ''));
106 db_add_column($ret, 'custom_link', 'query', 'varchar', array('default' => ''));
107 break;
108 }
109 return $ret;
110 }
111
112 function custom_links_uninstall() {
113 drupal_uninstall_schema('custom_links');
114 }

  ViewVC Help
Powered by ViewVC 1.1.2