Currently you can only put form elements into the 'Workflow' fieldset, which is quite limiting. This patch adds in some recursive merging of form arrays to allow elements to be added anywhere.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

drumm’s picture

FileSize
4.34 KB

And here is a patch without extra half-finished cruft from Amsteram.

crunchywelch’s picture

nice, I was wanting to do this today actually. +1 from me on visual review ;)

moshe weitzman’s picture

does form_alter hook not provide a solution?

drumm’s picture

Either we should completely remove this hook and use form_alter() for everything or go with the modification to the hook to make it work completely. I beleive using the hook makes things more readable, but I'd like to hear from some others.

adrian’s picture

+1

we use array_merge_recursive on the node form.

drumm’s picture

FileSize
5.56 KB

Here is a new patch which removes hook_nodeapi('settings', ...) entirely.

chx’s picture

Status: Needs review » Reviewed & tested by the community

hmm looks nice.

Dries’s picture

Status: Reviewed & tested by the community » Active

Committed to HEAD. Not marking 'fixed' until this change has been documented.

Gerhard Killesreiter’s picture

function upload_form_alter($form_id, &$form) {
  if (substr($form_id, -14) == '_node_settings') {
    $form['workflow']['upload_'. $node->type] = array(
      '#type' => 'radios', '#title' => t('Attachments'), '#default_value' => variable_get('upload_'. $node->type, 1),
      '#options' => array(t('Disabled'), t('Enabled')),
    );
  }
}

How is that supposed to work? $node is undefined.

killes@www.drop.org’s picture

Category: task » bug
Priority: Normal » Critical

Setting to critical bug, this simply does not work.

chx’s picture

Status: Active » Needs work
FileSize
1.79 KB

This is node module patch, the other modules need similar changes.

drumm’s picture

Good point. I can make a new patch (we don't need $node anyway) on Monday.

drumm’s picture

Status: Needs work » Needs review
FileSize
4.29 KB

Here is a complete fix.

Dries’s picture

Status: Needs review » Fixed

Committed to HEAD. Thanks.

drumm’s picture

The converting 4.6 -> HEAD and hook documentation are now updated.

Anonymous’s picture

Status: Fixed » Closed (fixed)