0

What is a good approach re structure and modules to be able to render site content based on a location drop down? It is not an option to display all the content via views.

I'm aware of Views Global Filter. This is be good, but it doesn't work against nodes for one. Therefor only addresses some of the site content.

In principle the user would select from a dropdown a location (custom, based on municipalities). This would then dictate the content presented to that user.

From the admin side, the menus stays the same. One could then create different 'versions' of the same page, each flagged for a specific locality. If the locality doesn't have a corresponding node version, the 'default' node version would be displayed.

Ultimately, I would like to be able to use one dropdown (session stored) that will affect the node content displayed, other views used on different pages and search results.

The translate module is very close, but I don't need the translate functionality, but the rest. Where a few objects are associated to the same url, but rendered depending on the filter.

Example Something like this (-no it's not a multi-council site, just the concept here):

id    page     name               zone
--    ----     ----               ----
1      1       Local Council      East  
2      1       Local Council      West  
3      1       Local Council      North
4      2       Building permits   East
5      2       Building permits   West
6      3       Pet Registration   East
etc...

main-menu:
Home | Local Council | Building | Pets

Therefor, the first page version will be the 'default' and any subsequent ones are then flagged for a zone. If a zone does not have a node with their flag, the default is displayed.

Location offers an option to get a location associated to the node, but how do I track the different 'versions' of the same page to same menu item then? And how do I stop search from giving me every version as a result?

I can see various bits that is getting close, but if some could explain the puzzle pieces please.

2
+50

There are two 'out of the box' solutions. The one is to use taxonomies to classify your content in different zones (one for the default zone), and views to decide when to display what.

All you then need to do is allow for your content to be self referencing - in other words add a entity relation field on each content type to itself.

So if you have a content type called basic_page, add an entity relation field in basic_page that can reference basic_page (cardinality of unlimited). Your default zone node can now have relations to nodes of the other zones.

The other option - the one I would rather consider - is using the entity-translation module. The module allows you to define 'custom languages'. Now each zone can be a 'language'. The fact that you are using languages to implement zones is the beauty abstraction - you are 'interpreting' language as a zone.

Using entity translation, all your node data is automatically 'grouped' as translations of the same entity.

I have done translations on Drupal sites a couple of times: IM me if you have questions.

  • Awesome, thanks JP. The methodology of the second option is what I was looking for, but couldn't find. Could you please confirm the impact of site searches for both? I would like the page varieties to searchable, unlike 'views'-pages. – piet Sep 29 '16 at 22:40
  • It would depend on how search is configured on your site - but since you are using entity translation, all pages will be index, in their respective (custom) languages - so you should be fine. It is just like any 'normal' multi-lingual site - if you search for content, the results would be index based on relevance and language. In your case your languages happens to be custom and actually refers to zones: but its all good. Shout if you have questions or need help. – JP Dippenaar Oct 8 '16 at 10:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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