- examples
- drupal
Functions & methods
| Name | Description |
|---|---|
| node_access_example_disable | Implementation of hook_disable(). |
| node_access_example_enable | Implementation of hook_enable(). |
| node_access_example_install | Implementation of hook_install(). |
| node_access_example_uninstall | Implementation of hook_uninstall(). |
File
developer/examples/node_access_example.installView source
- <?php
-
- /**
- * Implementation of hook_install().
- */
- function node_access_example_install() {
- switch ($GLOBALS['db_type']) {
- case 'mysql':
- case 'mysqli':
- db_query("
- CREATE TABLE {node_access_example} (
- nid int(10) unsigned NOT NULL default '0' PRIMARY KEY,
- private int,
- KEY node_example_nid (nid)
- ) /*!40100 DEFAULT CHARACTER SET utf8 */;
- ");
- break;
- case 'pgsql':
- db_query("
- CREATE TABLE {node_access_example} (
- nid int NOT NULL default '0',
- private int,
- PRIMARY KEY (nid));
- ");
- break;
- }
- }
-
- /**
- * Implementation of hook_enable().
- *
- * A node access module needs to force a rebuild of the node access table
- * when it is enabled to ensure that things are set up.
- */
- function node_access_example_enable() {
- node_access_rebuild();
- }
-
- /**
- * Implementation of hook_disable().
- *
- * A node access module needs to force a rebuild of the node access table
- * when it is disabled to ensure that its entries are removed from the table.
- */
- function node_access_example_disable() {
- node_access_example_disabling(TRUE);
- node_access_rebuild();
- }
-
- /**
- * Implementation of hook_uninstall().
- */
- function node_access_example_uninstall() {
- if (db_table_exists('node_access_example')) {
- db_query("DROP TABLE {node_access_example}");
- }
- }
-