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
Comment #1
Steven Jones CreditAttribution: Steven Jones commentedMy feeling is that this is bug in the documentation, but possibly the API. I will investigate.
Comment #2
helmo CreditAttribution: helmo commentedHmm 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 ...