You are here

function hook_hosting_tasks in Hosting 7.4

Same name and namespace in other branches
  1. 6.2 task/hosting_task.api.php \hook_hosting_tasks()
  2. 7.3 task/hosting_task.api.php \hook_hosting_tasks()

Define tasks that can be executed in the front-end.

Return value

array An array of arrays of tasks that can be executed by the front-end. The keys of the outer array should be the object that tasks operate on, for example 'site', 'platform' or 'server'. The values of the outer array should be an array of tasks keyed by task type, the value should be an array that defines the task. Valid keys for defining tasks are:

  • 'title': (required) The human readable name of the task.
  • 'command': (optional) The drush command to run. If not included, will assume "provision-TASKTYPE".
  • 'description': (optional) The human readable description of the task.
  • 'weight': (optional) The weight of the task when displayed in lists.
  • 'dialog' (optional) Set to TRUE to indicate that this task requires a dialog to be shown to the user to confirm the execution of the task.
  • 'hidden' (optional) Set to TRUE to hide the task in the front-end UI, the task will still be available for execution by the front-end however.
  • 'access callback' (optional) An access callback to determine if the user can access the task, defaults to 'hosting_task_menu_access'.
  • 'provision_save' (optional, defaults to FALSE) A flag that tells provision that a "provision-save" command needs to happen before this task can be run, used for tasks like Verify, Install, and Import. If you implement this option, you should implement hook_hosting_TASK_OBJECT_context_options() in order to pass parameters to the provision-save command.

See also

hosting_available_tasks()

hosting_task_TASK_TYPE_form()

Related topics

5 functions implement hook_hosting_tasks()

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

hosting_clone_hosting_tasks in clone/hosting_clone.module
Implements hook_hosting_tasks().
hosting_migrate_hosting_tasks in migrate/hosting_migrate.module
Implements hook_hosting_tasks().
hosting_platform_hosting_tasks in platform/hosting_platform.module
Implements hook_hosting_tasks().
hosting_server_hosting_tasks in server/hosting_server.module
Implements hook_hosting_tasks().
hosting_site_hosting_tasks in site/hosting_site.module
Implements hook_hosting_tasks().
2 invocations of hook_hosting_tasks()
hosting_available_tasks in task/hosting_task.module
Get a list of tasks that can be invoked by the user.
hosting_task_load in task/hosting_task.module
Implements hook_load().

File

task/hosting_task.api.php, line 42
Hooks provided by the hosting tasks module.

Code

function hook_hosting_tasks() {

  // From hosting_clone_hosting_tasks().
  $options = array();
  $options['site']['clone'] = array(
    'title' => t('Clone'),
    'description' => t('Make a copy of a site.'),
    'weight' => 5,
    'dialog' => TRUE,
    'command' => 'provision-clone',
  );
  return $options;
}