Integrate with core taxonomy
Amitaibu - May 9, 2008 - 20:44
| Project: | Workflow-ng |
| Version: | 5.x-2.x-dev |
| Component: | Wng Module Integration |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | patch (code needs review) |
Description
Attached patch has 3 actions:
Load existing vocabulary
Add and load a new vocabulary
Add a new term (you must load a vocabulary first)
| Attachment | Size |
|---|---|
| wfng_taxonomy_1.patch | 8.59 KB |

#1
interesting, thanks
-> you can shorten this code by just using array_filter($form_values['nodes']).
+ foreach ($form_values['nodes'] as $key => $node_type) {
+ if (empty($node_type)) {
+ unset($settings['nodes'][$key]);
+ }
+ }
this doesn't look good?
+ $settings['weight_vocabulary'] ? $settings['weight'] = $settings['weight_vocabulary'] : $settings['weight'] = 0;
It'd better be
$settings['weight'] = $settings['weight_vocabulary'] ? ...
Anyway, you could save this all, by just using $settings['weight'] everywhere, but don't using $form['weigt'] and adjusting the name in the submit handler $settings['weight'] = $form_values['form_name'];
I need to give this more testing, anyway I'd prefer more node related taxonomy integration like: Assign a term to a node + Remove a term from a node.
#2
Fago,
Thanks for the review, I'll work on the code.
I thought of doing this patch in steps, i.e. start with those basic actions and then extend them - too big patch is prone to no-review ;)
#3
Here's the new patch with node related actions.
1. Load vocabulary - should be used in order to add and load a new term.
2. Load term - Should be used in order to add/ remove term to/ from content.
I didn't get how you want to deal with the
$settings['weight']so left it as is.#4
hm, let me explain it better.
as for the form 'weight' can'T be used you can use, e.g. 'vocabulary_weight'.
The in your forms submit handler you return the settings as array('weight' => $form_values('vocabulary_weight')). So the value ends up in $settings['weight'] - where you can use it for setting the #default_value for the form element 'vocabulary_weight'.
#5
Ok, I think I got it now :)
Edit: as always, the drupal upload bug...
#6
When I added the latest patch as the two .inc files, I got an error when trying to add a vocab:
Parse error: syntax error, unexpected T_VARIABLE in /sites/all/modules/workflow_ng/workflow_ng/modules/workflow_ng_taxonomy_forms.inc on line 44
#7
I'm unable to reproduce the error, please send a screenshot of your form.
#8
I think there was an issue with my patch, I ran it again and it worked fine.
I'm a bit confused about the methodology for removing taxonomy terms. I have used the patch to add them fine, but not remove existing terms. Any help?
#9
Removing a term isn't yet implemented. Let's start with the existing patch and then extend it.