You are here

function hook_drush_context_import in Hosting 6.2

Same name and namespace in other branches
  1. 7.4 hosting.api.php \hook_drush_context_import()
  2. 7.3 hosting.api.php \hook_drush_context_import()

Import a backend context into the corresponding frontend node.

This hook will be invoked when an object is being imported from the backend into the frontend, for example a site that has just been cloned. You should inspect the context coming from the backend and store anything the frontend that you need to.

A node to represent the object will have already been created and is available to store things in, this node will be automatically saved after all implementations of this hook are called. You should not call node_save() manually on this node.

If you implement hook_hosting_TASK_OBJECT_context_options() then you will probably want to implement this hook also, as they mirror each other.

Parameters

$context: The backend context that is being imported.

$node: The node object that is being built up from the $context. You should modify the fields and properties so that they reflect the contents of the $context.

See also

hosting_drush_import()

hook_hosting_TASK_OBJECT_context_options()

Related topics

5 functions implement hook_drush_context_import()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

hosting_alias_drush_context_import in alias/hosting_alias.drush.inc
Implementation of hook_drush_context_import().
hosting_platform_drush_context_import in platform/hosting_platform.drush.inc
Implementation of hook_drush_context_import().
hosting_server_drush_context_import in server/hosting_server.drush.inc
hosting_site_data_drush_context_import in example/site_data/hosting_site_data.drush.inc
Implementation of hook_drush_context_import().
hosting_site_drush_context_import in site/hosting_site.drush.inc

File

./hosting.api.php, line 70
Hooks provided by the hosting module, and some other random ones.

Code

function hook_drush_context_import($context, &$node) {

  // From hosting_alias_drush_context_import().
  if ($context->type == 'site') {
    $node->aliases = $context->aliases;
    $node->redirection = $context->redirection;
  }
}