Skip to content

Instantly share code, notes, and snippets.

@Sanchiz
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sanchiz/8828278 to your computer and use it in GitHub Desktop.
Save Sanchiz/8828278 to your computer and use it in GitHub Desktop.
<?php
module_load_include('inc', 'ctools', 'includes/export');
// Load base enpoint and adding config for new subsite.
$base_taxonomy_endpoint = multisite_indicator_server_deploy_endpoints_default();
$endpoint = $base_taxonomy_endpoint['base_taxonomy_endpoint'];
$endpoint_url = $term->field_domain[LANGUAGE_NONE][0]['url'] . '/' . $endpoint->service_config['url'];
// Create machine name.
$endpoint->name = 'taxonomy_sync_' . preg_replace('@[^a-z0-9-]+@', '_', strtolower(drupal_strtolower($term->name)));
$endpoint->title = $endpoint->name;
$endpoint->description = t('Deployment taxonomy changes to @site site with services URL: @link', array('@site' => $term->name, '@link' => $endpoint_url));
$endpoint->export_type = NULL;
$endpoint->service_config['url'] = $endpoint_url;
// @TODO Set user from subsite endpoint.
$endpoint->authenticator_config = array(
'username' => 'username',
'password' => 'password',
);
ctools_export_crud_save('deploy_endpoints', $endpoint);
// Add endpoint to deployment plan.
$deploy_plan = ctools_export_crud_load('deploy_plans', 'taxonomy_sync');
$deploy_plan->endpoints[$endpoint->name] = $endpoint->name;
ctools_export_crud_save('deploy_plans', $deploy_plan);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment