function oa_core_create_space_page_callback in Open Atrium Core 7.2
Page callback for the 'Create space' page.
This a copy of 'page_manager_node_add' but with the title using the space_type name rather than just the content type name.
Parameters
string $type: The node content type name (ie. oa_space, oa_section).
integer $space_tid: The taxonomy term ID of the space_type or section_type.
See also
page_manager_node_add
2 string references to 'oa_core_create_space_page_callback'
- oa_core_menu in ./
oa_core.module - Implements hook_menu().
- oa_sections_menu in modules/
oa_sections/ oa_sections.module - Implements hook_menu().
File
- ./
oa_core.module, line 293
Code
function oa_core_create_space_page_callback($type, $space_tid) {
global $user;
if ($space_type = taxonomy_term_load($space_tid)) {
// Initialize settings:
$node = (object) array(
'uid' => $user->uid,
'name' => isset($user->name) ? $user->name : '',
'type' => $type,
'language' => LANGUAGE_NONE,
'is_new' => TRUE,
);
$title = t('Create @name', array(
'@name' => $space_type->name,
));
$pattern = '';
if ($type == OA_SPACE_TYPE) {
$pattern = '/space/i';
}
elseif ($type == OA_SECTION_TYPE) {
$pattern = '/section/i';
}
// if Taxonomy term name doesn't contain the type of page, then add it
if (!empty($pattern) && preg_match($pattern, $title) == 0) {
$types = node_type_get_types();
$title = t('Create @name @type', array(
'@name' => $space_type->name,
'@type' => $types[$type]->name,
));
}
drupal_set_title($title);
// Load the file with page_manager_node_edit().
module_load_include('inc', 'ctools', 'page_manager/plugins/tasks/node_edit');
return page_manager_node_edit($node);
}
return MENU_NOT_FOUND;
}