Skip to content

Instantly share code, notes, and snippets.

@GoZOo
Last active December 15, 2015 13:49
Show Gist options
  • Save GoZOo/5270023 to your computer and use it in GitHub Desktop.
Save GoZOo/5270023 to your computer and use it in GitHub Desktop.
Drupal .info, .module and .install templates for PhpStorm File Template
name =
description =
core = 7.x
package = Other
;dependencies[] =
;files[] =
;configure =
;stylesheets[all][] =
;scripts[] =
<?php
/**
* @file
* ${NAME}.module
*/
/**
* Implements hook_schema().
*
*
*/
function ${NAME}_schema() {
$schema = array();
// $schema['node'] = array(
// // example (partial) specification for table "node"
// 'description' => 'The base table for nodes.',
// 'fields' => array(
// 'nid' => array(
// 'description' => 'The primary identifier for a node.',
// 'type' => 'serial',
// 'unsigned' => TRUE,
// 'not null' => TRUE),
// 'vid' => array(
// 'description' => 'The current {node_revision}.vid version identifier.',
// 'type' => 'int',
// 'unsigned' => TRUE,
// 'not null' => TRUE,
// 'default' => 0),
// 'type' => array(
// 'description' => 'The {node_type} of this node.',
// 'type' => 'varchar',
// 'length' => 32,
// 'not null' => TRUE,
// 'default' => ''),
// 'title' => array(
// 'description' => 'The title of this node, always treated as non-markup plain text.',
// 'type' => 'varchar',
// 'length' => 255,
// 'not null' => TRUE,
// 'default' => ''),
// ),
// 'indexes' => array(
// 'node_changed' => array('changed'),
// 'node_created' => array('created'),
// ),
// 'unique keys' => array(
// 'nid_vid' => array('nid', 'vid'),
// 'vid' => array('vid')
// ),
// 'foreign keys' => array(
// 'node_revision' => array(
// 'table' => 'node_revision',
// 'columns' => array('vid' => 'vid'),
// ),
// 'node_author' => array(
// 'table' => 'users',
// 'columns' => array('uid' => 'uid')
// ),
// ),
// 'primary key' => array('nid'),
// );
return $schema;
}
/**
* Implements hook_install().
*
*/
function ${NAME}_install() {
}
/**
* Implements hook_enable()
*/
function ${NAME}_enable() {
}
/**
* Implements hook_disable()
*/
function ${NAME}_disable() {
}
/**
* Implements hook_uninstall().
*/
function ${NAME}_uninstall() {
// Remove variables
db_query("DELETE FROM {variable} WHERE name LIKE ':name_%%'", array(':name' => '${NAME}'));
}
<?php
/**
* @file
* ${NAME}.module
*/
/* *********************************************************************
* DEFINES & INIT
* ****************************************************************** */
/* *********************************************************************
* MENU ROUTER & PERMISSIONS
* ****************************************************************** */
/**
* Implements hook_menu().
*
*
*/
function ${NAME}_menu() {
$items = array();
// $items['blog'] = array(
// 'title' => 'blogs',
// 'page callback' => 'blog_page',
// 'access arguments' => array('access content'),
// 'type' => MENU_SUGGESTED_ITEM,
// );
// $items['blog/feed'] = array(
// 'title' => 'RSS feed',
// 'page callback' => 'blog_feed',
// 'access arguments' => array('access content'),
// 'type' => MENU_CALLBACK,
// );
return $items;
}
/* *********************************************************************
* ENTITY
* ****************************************************************** */
/* *********************************************************************
* FIELDS
* ****************************************************************** */
/* *********************************************************************
* BLOCKS
* ****************************************************************** */
/* *********************************************************************
* HOOKS
* ****************************************************************** */
/* *********************************************************************
* THEME
* ****************************************************************** */
/**
* Implements hook_theme().
*/
function ${NAME}_theme() {
return array();
} // ${NAME}_theme
/* *********************************************************************
* VARIABLES
* ****************************************************************** */
/**
* Implements hook_variable_info().
*/
function ${NAME}_variable_info($options) {
} // ${NAME}_variable_info
/**
* Implements hook_variable_group_info().
*/
function ${NAME}_variable_group_info() {
} // ${NAME}_variable_group_info
/**
* Implements hook_variable_locale().
*/
function ${NAME}_locale($op = 'groups') {
} // ${NAME}_locale
/* *********************************************************************
* HELPERS
* ****************************************************************** */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment