function hook_drush_context_import

7.x-3.x hosting.api.php hook_drush_context_import($context, &$node)

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.


object $context: The backend context that is being imported.

object $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



Related topics

6 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/
Implements hook_drush_context_import().
hosting_platform_drush_context_import in platform/
Implements hook_drush_context_import().
hosting_server_data_drush_context_import in example/server_data/
Implements hook_drush_context_import().
hosting_server_drush_context_import in server/
@todo Please document this function.
hosting_site_data_drush_context_import in example/site_data/
Implements hook_drush_context_import().

... See full list


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


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;