0

I have a site with three grouptypes (organic groups). I am still sort of finding out the right structure as i want each group type to have their own (predefined) taxonomyterms. (og vocab will not work as this is per group)

Should i give each grouptype a different groupcontenttype. This way i can divide my vocabularies over each groupcontentype. This way i will have a clear distinction per grouptype. However it results in more maintenance as i need to make views (filtering taxonomy) and panelpages per grouptype.

Is there some other way that i am not aware of using just one groupcontenttype for all my grouptypes and being able to set the proper vocabulary on them?

2 Answers 2

0

If the number of group types is relatively small and consistent, you might consider adding several taxonomy term fields to the base groupcontenttype, each referencing the relevant grouptype specific vocabulary, and then hiding the fields that are not relevant to a group's type.

If you hid the field on the node edit page using a switch statement (on group type) in hook_form_alter, then ensured that empty fields were not displayed on the node, then both visitor and admin would not see irrelevant fields.

4
  • Thanks, as i am still developing my php skills, could you provide a small example of such a switch statement?
    – Byron
    Commented Feb 5, 2015 at 14:19
  • happy to provide working example, though will need to get back to you in a couple of hours - in the meantime, if you are not fully conversant with php, it may be worth looking for a drupal module that hides fields based on criteria/groups Commented Feb 6, 2015 at 10:22
  • Would be great. As for modules: could'nt find much around other then Conditional fields and Field formatter conditions. As far as i know both modules are not suitable...
    – Byron
    Commented Feb 6, 2015 at 14:16
  • Sorry I didn't get back to you on this, time limited Commented Mar 4, 2015 at 10:30
0

I have several OG sites in which the groups structure group content using either taxonomy terms or nodes as categories. In my experience, working with nodes is easier than taxonomy in OG sites, but it depends on your specific purpose. Out of the box non-admin user can't create terms via admin-interface, while they can create nodes, thus also category-like nodes.

In short, using nodes: create a content type 'category' and set it as being group content. Use a entity reference field in all content types, referencing that content type. Create a view that lists only category nodes part of currently viewed group. In the category content type ER field settings, entity selection, set your view you just created.

The same applies to terms:

I quote https://www.drupal.org/node/1507608#comment-8178015

Create a group audience for your vocabulary Edit the created field and within "GROUPS AUDIENCE FIELD OPTIONS", set "Node", "Organic groups"

Go to Views and create a "Term View" Set "Format" to "Entity Reference list" Set "Format options" to the field you need (Taxonomy name for example) Add a "Filter Criteria" "Vocabulary name" to filter terms Add a "Contextual Filter" "OG membership: Group ID". There is no context since we are creating a node, so tick "Provide default value" > "The OG groups of the logged in user". Leave the other two settings "Group type" and "Concatenator". Go to your content type and create an "Entity Reference" field In "Field options" set "Target type" to "Taxonomy Term" In "Entity selection" set "mode" and select your View. I leave arguments empty Create your node and check how taxonomies are filtered Hope it helps someone :) If your user can't create the term via admin-interface, perhaps rules can help to set the group audience. It's only a thought...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.