3

We're having a bit of a difficulty finding the best way to solve the current issue: it's a multi-site and multi-lingual set-up for a customer that is active in different countries. For each country a separate database is uses (multi-site) and each country has an English + local language variation (multi-lingual).

The customer also has a split audience (private vs. business) and all pages have a one-to-one match, meaning if you are on a /en/private/foo page, you could go to /en/business/foo just by switching the target audience (same way the language switcher works).

The problem is you'll have two switcher blocks on the page that have to be in sync:

  • language (english/local language)
  • audience (private/business)

How would you split the content and keep the relation between the different nodes for different audience groups? This also has impact on other Drupal components, the menu for example.

We've been looking at two different approaches:

  • separation on content level (taxonomy or field to select the audience group)
  • grouping the content (e.g. og module, or the new kid on the block group)

Any people out there that had the same issue and how did you solve it?

6
  • You can just add Context plugin + some switch.
    – user21641
    Oct 3, 2016 at 11:09
  • Great question I'm interested in doing the same with countries on D8 (have 1 site, but be able to switch country as well as language for content sorting and have it in url like language.) So please do post your solution once you have it :) Oct 5, 2016 at 13:19
  • @IvanJaros What exactly do you mean with just add Context. Could you expand on your answer, how could Context solve this issue?
    – Max
    Oct 6, 2016 at 12:16
  • If you edit a block you can see display rules like content type, page, user role...all of those are context plugins in block group. So you can create new context plugin, put it into "site" group or whatever and then use context plugin manager in your logic.
    – user21641
    Oct 6, 2016 at 12:51
  • @Max : what do you have in place (or how do you enforce) that "all pages have a one-to-one match"? E.g. the moment you create a new (say) business-page, you can impossibly (at the very same moment) also have a (say) private-page equivalent? Or is it OK to assume that for any (say) business-page there "might be" some private-page equivalent with a path in which "business" is changed to "private"? Oct 6, 2016 at 15:45

2 Answers 2

2
+25

@max I am assuming that since there is a 1-1 relation between 'private' and 'business' content, you are probably just hiding (restricting) content in on of the two. So if for example, your 'private' content is only available to authenticated users, or user who paid for the content, then essentially the other (business) content is a reduced version (teaser)?

If that is the case, then maybe you can consider using different display modes for the same node - in other words, you only have one node for both business and private, but with different view modes. The one with restricted access (lets assume that is business) will show nodes using the 'teaser' view, while the other will render the node using the 'full' display mode.

It should be easy enough to change the display mode dynamically on load / render based on the user's status (logged in, paid for content, etc).

The other option, and you could even combine this, is to use content access modules, specifically field level access, to automatically control which fields will be rendered or not. So in this configuration, you could always render the node using the same (possibly different) display modes, but based on the authentication level of the user, simply do not show the field: I can confirm that I have personally used this and it does work (http://www.startnetwork.org).

All things being equal, I would personally only have one node (as opposed to 2 implicitly related nodes) and then simply control what information (or how much) is shown.

If you have any questions - please let me know: happy to help.

7
  • it's actually not restricted based on the user roles. That would have made it a lot easier. By private, I meant private individuals. Sorry for the confusion. I do like your idea for combining the private/business in a single node and then restricting depending on the context. Will look into it.
    – Max
    Oct 12, 2016 at 9:28
  • Ah yes - OK I understand. Still believe the two possibilities listed above will work. Please let me know if you have any questions: happy to help. Oct 12, 2016 at 11:38
  • One last thing JP, you're idea is looking promising but it has one small shortcoming. By having a single node, there's a single path alias and we need 2 different aliases for each target audience group. Something like /private/foo and business/foo.
    – Max
    Oct 13, 2016 at 8:44
  • Hi @max - this may solve that problem: drupal.org/documentation/modules/pathauto. Basically we define an alias. So the 'default' path could be /private/???? and then using PathAuto we always define an alias using a pattern /business/???? Oct 13, 2016 at 9:50
  • Yes, pathauto is being used, but it doesn't allow multiple URL aliases for the same node. I just tried it and in D8 and you can specify multiple patterns for the same entity type and bundle, but it will only generate a single alias. And I don't see a default pattern option.
    – Max
    Oct 13, 2016 at 10:17
0

I would use the Group module to create a group for each country, and combine that with using the subgroup sub-module to implement 4 subgroups for each country:

  • Business - English language.
  • Private - English language.
  • Business - Local language.
  • Private - Local language.

That will give you already a solution that works for D8, with all the flexibility you need to organise (split) your content based on your target audience.

Since the Group module is fully entity based, you can take advantage of any type of typical functionality offered by modules such as the Views module.

And for anything that requires custom code, you have various hooks available (refer to the Development Guide for some more details on that).

1
  • Thanks @pierre-vriens, I had a look at this module and it's a nice solution for grouping the content. But that's half the battle, it doesn't solve the relationship between the different group types.
    – Max
    Oct 13, 2016 at 10:13

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.