When i use from_alter + pre_host_task to actually inject checkboxes into form like clones ( "clone files?" ) it works without issues. current iam working on the "purge" option for deletion.

Also using form alter with

if ($form_id == 'hosting_task_confirm_form' && $form['task']['#value'] == 'delete') {
      $form['purge'] = array(
        '#type' => 'checkbox',                                                      
        '#title' => t('Purge'),                                                     
        '#default_value' => 0,                                                      
        '#description' => t('Purge and force deletion'),
      );
    }

And later and the pre_hosting_task hook

  $task =& drush_get_context('HOSTING_TASK');                                       
  if ($task->ref->type == 'platform' && $task->task_type == 'delete') {      
    $task->options['purge'] = $task->task_args['purge'];
  }

$task->task_args is completely empty, actually $tasks does not have any values submitted by the confirmations form. I guess that is an API issue somewhere, but once again very hard for me to debug, as it must be somewhere hidden in the task-abstraction API.

Any hints on how i could get this working? So how to pass a form value from the task ( confirmation form ) to the drush_hook_pre_hosting_task hook.

Comments

Steven Jones’s picture

Project: Provision » Hostmaster (Aegir)
Version: » 6.x-2.x-dev
Component: Code » Documentation
Assigned: Unassigned » Steven Jones
Category: support » bug

My feeling is that this is bug in the documentation, but possibly the API. I will investigate.

helmo’s picture

Issue summary: View changes
Status: Active » Closed (works as designed)

Hmm very old issue :(

A wokring example of such code is in http://cgit.drupalcode.org/hosting_git/tree/hosting_git.drush.inc#n22

Hope it helps, feel free to re-open ...