Could you please add support for the multigroup module? The content taxonomy options works nicely, but it needs to implement a couple of hooks so that the multigroup module knows these widgets are compatible.

Also, it's been requested by cat999 in comment #260 here: #119102: Combo field - group different fields into one

Please, see attached patch. It's against the D6 branch of the content taxonomy module.

Thanks! :)

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

markus_petrux’s picture

BTW, The patch I attached above also removes the closing PHP tag from the end of the script.

mh86’s picture

Status: Needs review » Postponed

I'm going to wait to commit this patch until a multigroup module is committed to CCK (or own project)

denislabonkink’s picture

Hi,
I applied the patch content_taxonomy.multigroup.patch and it failed. It says the following:

>patch -p0 < content_taxonomy.multigroup.patch
patching file content_taxonomy_options.module
Hunk #1 FAILED at 76.
1 out of 1 hunk FAILED -- saving rejects to file content_taxonomy_options.module.rej

I applied the patch against content_taxonomy-6.x-1.x-dev.tar.gz

Does some1 know what I did wrong.

thx!

markus_petrux’s picture

The PHP closing tag in the affected file was already removed on CVS, so the patch here is broken by that.

All you need to do is append the following functions to the end of content_taxonomy_options.module

/**
 * Implementation of hook_content_multigroup_allowed_widgets().
 */
function content_taxonomy_content_multigroup_allowed_widgets() {
  return array('content_taxonomy_options', 'content_taxonomy_select');
}

/**
 * Implementation of hook_content_multigroup_no_remove_widgets().
 */
function content_taxonomy_content_multigroup_no_remove_widgets() {
  return array('content_taxonomy_options', 'content_taxonomy_select');
}
ARray’s picture

Why didn't you included 'content_taxonomy_autocomplete' in array?

markus_petrux’s picture

hmm... I believe taxonomy autocomplete is used for freetagging, and a single widget manages several values, which is not possible within the context of a multigroup.

Please, see comment #305 for an examplanation on why:

http://drupal.org/node/119102?page=1#comment-1191555

ARray’s picture

So may be there can be added some restrictions to "autocomplete" widget. For example: it will save only first value if it is located inside of content_multigroup.
Can it be realized in that way?

markus_petrux’s picture

Well, I guess this would need a modification on the autocomplete widget to react acoordingly when the multiple values of the field is set to 0 (meaning just one value per widget), which is what the multigroup does to fields as it can only deal with one single value per subgroup of fields.

Otherwise, the user could still enter several terms on a freetagging field part of a multigroup, but only the first one would be stored in the database. =:-o

ARray’s picture

There is another issue: If you try to save node with content taxonomy field located in multigroup it won't be saved correctly.
But if you enter a number in content taxonomy field it will show a term in a node view page. But if you try to edit the node and save again, field value will be lost.
See attachment.

markus_petrux’s picture

I would like to mention that filefield already committed changes to their CVS to offer forward compatibility with the content multigroup module. Please, see #367267: Compatibility issues with Content Multigroup

Latest news on the content multigroup module can be found on comment 119102#424: Content multigroup issue.

All it's needed here is the implementation of a couple of multigroup hooks, as described in #4 above. A plus would be if the freetagging widget could work with an arbitrary number of multiple values, otherwise this widget cannot be used within the context of multigroups as described here.

koala098’s picture

subscribe

cyberswat’s picture

I've tested this patch in conjunction with all the latest changes going on between multi group, cck and date. It worked as expected with none of the data loss identified in #9

aries’s picture

I can confirm #12, works as should.

yasheshb’s picture

markus_petrux:

hi.. first off, great work on the multigroup functionality http://drupal.org/node/119102. thx to all who've contributed to it.
i've started using it after using the patch from comment 512 (http://drupal.org/node/119102?page=1#comment-1422558) and instructions from
comment 468 (http://drupal.org/node/119102?page=1#comment-1386736)

i also installed content_taxonomy 6.x-1.0-beta6 and applied the patch (basically added the 2 hooks at the end of the file content_taxonomy_options.module)
i'm assuming this works for a field of type content_taxonomy that does not use autocomplete.

however, i was playing around with a sample field like this

content type = ct1
group g1 = standard
group g2 = multigroup

field f1 as follows

Type of data to store - Content Taxonomy Fields

Form element to edit the data - Autocomplete (Freetagging)

Settings for Autocompletes
Freetagging settings: Deny any new terms

Global settings
Number of values: 1

After saving this field, i noticed that a new table "content_field_f1" is not created but instead a field "field_f1_value"is added to the table "content_type_ct1".
this would mean that this is a single valued field since it's stored at the content_type table.

Now when i try to drag the field f1 and drop it into group g1 and click on save, it gives the error message "This change is not allowed. The field f1 handles multiple values differently than the Content module. Making this change could result in the loss of data."

Is this the correct workflow for a single valued content_taxonomy field using autocomplete(freetagging) ?

thx.

yashesh

markus_petrux’s picture

Yes, but freetagging is not supported for multigroups. Only the widgets of type 'content_taxonomy_options' and 'content_taxonomy_select' are supported.

See explanation here:

http://drupal.org/node/119102?page=1#comment-1191555

BTW, when you create a field that you wish to add to a multigroup, you can drop it directly inside the multigroup from the 'Add field' section. That way the first field is created in the correct table. Otherwise, the field is added at the content type table, and then to a separate table for the field when you drop it into the multigroup.

yasheshb’s picture

FileSize
146.33 KB

markus_petrux

thx for the reply. i read comment # 305 and it mentioned
"Since the freetagging field is a multiple values field per definition" hence it cannot be supported for multigroup.

however, when you do create a cck field of type content taxnomy using the autocomplete freetagging widget
it does not create another table but instead it creates an extra column in the table of the content type.
(this is when the user chooses "Number of values" = 1 when creating the cck content taxonomy field).

would this not imply only single value field for autocomplete freetagging ?
i also tried to add more than one term to a dummy content type with field

f1 of content_taxonomy/autocomplete/num_value 1
and when i tried to add more than 1 value it gave an error message

this could then be used in a multigroup imho. maybe i'm looking at a wrong angle ?

thx.

yashesh

markus_petrux’s picture

I haven't checked if the freetagging widget can work with single values. If so, it would be possible to try if it works in multigroups. For this, you only need to add 'content_taxonomy_autocomplete' to the list of items returned by the implementations of multigroup related hooks above.

The number of values for fields in multigroups is managed by the multigroup module, and it generates single value fields for each subgroup of fields in the multigroup. If that is supported by the freetagging widget and works, then great, we can add this widget to the list in the hooks.

If you try, be sure to have backups of your database. You will also need to clear caches after changing the code, and then try to edit the content types and play with the fields to see what happens.

markus_petrux’s picture

Status: Postponed » Needs review
FileSize
727 bytes

@all: I have tested the content taxonomy autocomplete widget and it worked, so this one can also be added to the list of supported widgets on the content_multigroup hooks. The only caveat is that you can only attach a single term to an item when using taxonomy fields in multigroups because CCK can only support one dimension of delta values. Each field accept multiple values, but under the context of multigroups, each value is managed from its own subgroup in the multigroup.

@mh86: The multigroup module has been committed to CVS, as part of a new experimental branch in CCK. :-D

The new branch has a development snapshot that can be downloaded from here:

http://drupal.org/node/484068

For further information, please see the latest comments here: #196421: Deleting unwanted multiple values / multiple values delta issues

I'm attaching a patch against current dev code of the content taxonomy module to implement the content_multigroup hooks that are needed in order to use these widgets on multigroups.

asb’s picture

thank you for this! subscribing

markus_petrux’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
986 bytes

Here's an updated patch against latest cvs code.

I have moved the implementation of the content_multigroup hooks to content_taxonomy.module. Previous patches added them to the content_taxonomy_options module, but later we realized the content_taxonomy_autocomplete was also compatible with multigroups, so this now may belong to content_taxonomy. Makes more sense like this, I think.

mh86’s picture

Status: Reviewed & tested by the community » Fixed

Hi!

I committed your patch from #20! Thanks for your work!
I tried to add the content_taxonomy_tree widget to the allowed widget list, but as soon as I used a content_taxonomy_tree in the multigroup widget, the group stopped working (no values saved). are there any special reasons for this?

Anyway, works fine with other widgets! Great new feature!

markus_petrux’s picture

Thank you! :)

I tried to add the content_taxonomy_tree widget to the allowed widget list, but as soon as I used a content_taxonomy_tree in the multigroup widget, the group stopped working (no values saved). are there any special reasons for this?

I do not recall exactly, but when I tried, there were issues with the way the multiple values are managed by the widget.

The multigroup tries to manage the form in several ways to avoid this kind of problems, but it has limitations.

I'm not sure it if would be easy to build the taxonomy tree element in a way that's compatible with the multigroup. This needs investigation, and I has not time to do so.

Thanks again. The other taxonomy widgets work just fine. :)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Junro’s picture

Status: Closed (fixed) » Active

Hello,

Freetagging widget with multiple values is still not supported for multigroups?

Thanks

Magnus’s picture

Status: Active » Closed (fixed)

Please reopen issue if problem still exists.

mdorrell’s picture

subscribe

Roze-1’s picture

Subscribing !

Roze-1’s picture

I am having problem with the Content Taxonomy -> Hierarchical Select
with the error message as
"This change is not allowed. The field Test handles multiple values differently than the Content module. Making this change could result in the loss of data."
Please enlighten me with this module.
Thanks in Advance!

iRex’s picture

Having the same issue problem with Content Taxonomy -> MultiSelect