View source
<?php
define('CONTENT_TYPE_GROUPS_ENTITY_NAME', 'content_type_group');
define('CONTENT_TYPE_GROUPS_ADMIN_PATH', 'admin/structure/type/groups');
function content_type_groups_help($path, $arg) {
if ($path == 'admin/help#content_type_groups') {
$output = '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t("The Content type groups module allows you to create groups of content types for reference in forms and views") . '</p>';
$output .= '<p>' . t("The module provides a configuration screen allowing administrators to define an unlimited amount of content type groups") . '</p>';
return $output;
}
}
function content_type_groups_node_type_update($info) {
if (isset($info->old_type)) {
ContentTypeGroup::renameContentType($info->old_type, $info->type);
}
}
function content_type_groups_node_type_delete($info) {
ContentTypeGroup::removeContentType($info->type);
}
function content_type_groups_theme() {
return array(
'content_type_groups_group_form' => array(
'render element' => 'form',
'file' => 'content_type_groups.theme.inc',
),
);
}
function content_type_groups_views_api() {
return array(
'api' => 2,
);
}
function content_type_groups_features_api() {
return array(
'content_type_groups' => array(
'name' => t('Content type groups'),
'default_hook' => 'content_type_groups_features_default_settings',
),
);
}
function content_type_groups_entity_info() {
return array(
'content_type_group' => array(
'module' => 'content_type_groups',
'label' => t('Content type group'),
'base table' => 'content_type_groups_groups',
'entity keys' => array(
'id' => 'type',
),
'entity class' => 'ContentTypeGroup',
'controller class' => 'ContentTypeGroupController',
'load hook' => 'content_type_groups_group_load',
'label callback' => 'entity_class_label',
'uri callback' => 'entity_class_uri',
'admin ui' => array(
'path' => 'admin/structure/types/groups',
'file' => CONTENT_TYPE_GROUPS_ADMIN_PATH,
'controller class' => 'ContentTypeGroupUIController',
),
),
);
}
function content_type_groups_group_load($id, $reset = FALSE) {
return array_shift(content_type_groups_group_load_multiple(array(
$id,
), array(), $reset));
}
function content_type_groups_group_load_multiple($ids = array(), $conditions = array(), $reset = FALSE) {
return entity_load(CONTENT_TYPE_GROUPS_ENTITY_NAME, $ids, $conditions, $reset);
}