'admin/content/types/deploy', 'title' => t('Deploy'), 'description' => t('Add a content type to a deployment plan.'), 'callback' => 'content_copy_deploy_add', 'access' => user_access('add items to deployment plan'), 'type' => MENU_LOCAL_TASK ); return $items; } /** * menu callback to deploy a content type */ function content_copy_deploy_add($type = NULL) { $plans = deploy_get_plans(); if (!empty($plans)) { $form = drupal_get_form('content_copy_deploy_add_form', $plans); return $form; } else { return "No deployment plans available"; } } /** * deploy content type form */ function content_copy_deploy_add_form($plans) { $types = content_copy_types(); $form['pid'] = array( '#title' => t('Deployment Plan'), '#type' => 'select', '#options' => $plans, '#description' => t('The deployment plan to add this content type to'), ); $form['content_type'] = array( '#title' => t('Content Type'), '#type' => 'select', '#options' => $types, '#description' => t('The content type to deploy'), ); $form['submit'] = array( '#type' => 'submit', '#value' => t('Submit'), ); return $form; } /** * deploy content type form submit callback */ function content_copy_deploy_add_form_submit($form_id, $form_values) { $pid = $form_values['pid']; $content_type = $form_values['content_type']; $module = 'content_copy'; $description = "Content Type: $content_type"; deploy_add_to_plan($pid, $module, $description, $content_type); return "admin/deploy/list/$pid"; } /** * deploy content deployment 'hook' */ function content_copy_deploy($url, $api_key, $content_type) { $groups = array(); if (module_exists('fieldgroup')) { $groups = content_copy_groups($content_type); } $fields = content_copy_fields($content_type); $fields = array_keys($fields); $values = array( 'type_name' => $content_type, 'groups' => $groups, 'fields' => $fields ); $export = content_copy_export('content_copy_export_form', $values); // for the moment, we are assuming any deployed content type is being newly created // so we're hardcoding create here drupal_set_message(xmlrpc($url, 'content_copy.import', $api_key, 'create', $export)); }