Been trying to figure out how to remove the content taxonomy field from a node edit form via hook_form_alter. I'm trying to enforce being able to set the taxonomy only during node creation, that any editing it is read-only or not visible at all.

I have tried setting $form['field_name']['tids']['#disabled'] = true, $form['field_name']['tids']['#type'] = 'value', and other similar tactics. All these result in this error:
Illegal offset type in content_taxonomy_options.module on line 159.

Line 159 of that is inside hook_widget in the 'process form values' op:
$keys[$node_field['tids']] = $node_field['tids'];

I know this is due to my own ignorance. I have used the above technique with other 'normal' fields in the past successfully.. I guess this has to do with this particular widget being a select list or something. Any help or tips would be appreciated!

Thanks

Comments

reubenavery’s picture

Oh, I also wanted to mention that I tried setting $form['field_name']['tids']['#access'] = false and even $form['field_name']['#access'] = false as well, but the above error on line 159 comes up regardless.

magnus’s picture

Status: Active » Closed (won't fix)

Cleanup of old issues. According to maintainer: "active development is only done for the 6.x branch! 5.x is not supported any more".
Reopen issue if problem still exist in 6.x branch.