0

I have two content types. One content type is 'sport' and a other content type is 'teacher'. I collected the content type 'teacher' with views and I display the fields in a block (this is important for my site set-up).

My content type 'sport' is seperated from the content type 'teacher' (this is also important for my site set-up). My content type ‘sport’ is the content type where my block ‘teacher’ is showing up.

My page is look like this:

enter image description here

If I create a new sport like basketball, the information of soccer changes into the information about basketball and the teacher should be Rob (choose from a dropdown when creating a page from content type 'sport').

6
  • Do you mean how to hide a block created from a specific content type when showing a node of a different content type?
    – apaderno
    Mar 2, 2016 at 16:57
  • Remember that a block has settings for where to put the block, and that is in the block settings, not the view settings. For example, for the user login block, the settings are in admin/structure/block/manage/user/login/configure.
    – apaderno
    Mar 2, 2016 at 17:05
  • In particular, see this: d.pr/i/CVHv.
    – apaderno
    Mar 2, 2016 at 17:07
  • @kiamlaluno I have two content types. 'Sport' and 'teacher' I want to be able to choose a teacher per sport (per node). As example: Soccer = teacher Peter, Basketball = teacher Jack. I created a block with views to show the teacher. When I choose nothing, the block is not showing up.
    – honline
    Mar 2, 2016 at 17:08
  • Please add that information in the question. I still don't understand exactly what you are trying to achieve, but if you want to associate a teacher node to every sport node, you need one of the modules that add a reference field to a node. In that way, when creating a sport node, you can select a teacher node for that node.
    – apaderno
    Mar 2, 2016 at 17:15

1 Answer 1

0

I found a solution.

I followed the following steps:

  • I have created an entity reference (in the content type sport)
  • I have created a view with relationship to the entity reference
  • I have created a contextual filter, content Nid with the relationship I created before to the entity reference field.

Everything works now!

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.