Examples project
.info
, .module
and .install
name = Date Popup
description = Enables jquery popup calendars and time entry widgets for selecting dates and times.
dependencies[] = date_api
package = Date/Time
core = 7.x
configure = admin/config/date/date_popup
stylesheets[all][] = themes/datepicker.1.7.css
/**
* Load needed files.
*/
function date_popup_add() {
static $loaded = FALSE;
if ($loaded) {
return;
}
function commerce_coupon_schema() {
$schema['commerce_coupon'] = array(
'description' => 'The base table for coupons.',
'fields' => array(
'coupon_id' => array(
'description' => 'The primary identifier for the coupon.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
[module].rules_defaults.inc
[module].views_defaults.inc
[module].admin.inc
files[] = path/to/filename.inc
hook_[my_module]_office_presave()
module_invoke_all($hook, $arg1, $arg2)
Implements hook_[hook]()
drupal_alter($type, $data, $arg1, $arg2)
Implements hook_[type]_alter()
// Let modules modify the node before it is saved to the database.
module_invoke_all('node_presave', $node);
module_invoke_all('entity_presave', $node, 'node');
drupal_alter('field_formatter_settings_form',
$form['options']['settings'],
$context);
$callbacks = array();
foreach (module_implements('menu') as $module) {
$router_items = call_user_func($module . '_menu');
if (isset($router_items) && is_array($router_items)) {
foreach (array_keys($router_items) as $path) {
$router_items[$path]['module'] = $module;
}
$callbacks = array_merge($callbacks, $router_items);
}
}?
function module_invoke_all($hook) {
$args = func_get_args();
// Remove $hook from the arguments.
unset($args[0]);
$return = array();
foreach (module_implements($hook) as $module) {
$function = $module . '_' . $hook;
if (function_exists($function)) {
$result = call_user_func_array($function, $args);
if (isset($result) && is_array($result)) {
$return = array_merge_recursive($return, $result);
}
elseif (isset($result)) {
$return[] = $result;
}
}
}
return $return;
}
function poll_node_info() {
return array(
'poll' => array(
'name' => t('Poll'),
'base' => 'poll',
'description' => t('A poll is a question with a set of possible responses. A poll, once created, automatically provides a simple running count of the number of votes received for each response.'),
'title_label' => t('Question'),
'has_body' => FALSE,
),
);
}
foreach (module_implements('node_info') as $module) {
$info_array = module_invoke($module, 'node_info');
foreach ($info_array as $type => $info) {
$info['type'] = $type;
$_node_types->types[$type] = node_type_set_defaults($info);
$_node_types->types[$type]->module = $module;
$_node_types->names[$type] = $info['name'];
}
}
/**
* Load all module includes as soon as this file gets included, which is done
* automatically by module_implements().
*/
foreach (rules_core_modules() as $module) {
module_load_include('inc', 'rules', "modules/$module.rules");
module_load_include('inc', 'rules', 'modules/events');
}
What do I hope you'll take away from this talk?