You are here

function oa_clone_create_space_page_callback in Open Atrium Clone 7.2

Page callback that either returns the normal create page or a clone page.

Checks the 'Space Blueprint' taxonomy to see if this is a clone type or a normal type and returns either the normal page from 'oa_clone' or the clone page from 'clone'.

Parameters

string $type: The node content type name (ie. oa_space, oa_section).

integer $space_tid: The taxonomy term ID of the 'Space Blueprint'.

See also

oa_core_create_space_page_callback()

oa_clone_node_prepopulate()

1 string reference to 'oa_clone_create_space_page_callback'
oa_clone_menu_alter in ./oa_clone.module
Implements hook_menu_alter().

File

./oa_clone.module, line 170

Code

function oa_clone_create_space_page_callback($type, $space_tid) {
  if ($space_type = taxonomy_term_load($space_tid)) {

    // If this is a clone type, then return oa_clone_node_prepopulate().
    $wrapper = entity_metadata_wrapper('taxonomy_term', $space_type);
    if ($wrapper->field_oa_clone_enabled
      ->value() && ($node = $wrapper->field_oa_clone_space
      ->value())) {
      drupal_set_title(t('Create @name Space', array(
        '@name' => $space_type->name,
      )));
      $node->oa_clone_bypass_access_check = TRUE;
      return oa_clone_node_prepopulate($node, FALSE);
    }

    // Otherwise, we fallback on oa_core_create_space_page_callback().
    return oa_core_create_space_page_callback($type, $space_tid);
  }
  return MENU_NOT_FOUND;
}