5

Am I able to add the following field to a content type, so that each piece of content I create can be conditioned to a page?

specific page field

Or is there a module to extend Publishing Options, where by it adds all the pages I have created (just like 'Promote to Front Page')? If not, why is no one doing this? As a new user to Drupal this seems like it would be a handy operation. (I have already tried this module but it doesn't achieve the results I'm after).

If none of these solutions are available, what would be the best alternative way of doing this?

  • What are you trying to do, show certain slides on certain pages? – Alex Gill Nov 7 '12 at 11:15
  • No sorry, the image is just an example of the input field I would like for my content type. – PapaSmurf Nov 7 '12 at 11:16
1

First, you start with defining what are the rules of showing this content to the user. There are many ways how to deal with such a thing, but it all depends on the rules. I do recommend to create such rules, otherwise you will run into unmaintanable mess.

If you have less than 10 or so occurences

You can use the bean module (http://drupal.org/project/bean) to create specific block types with fields (similar way like creating content types). These blocks you can then expose via the default blocks UI and set the visibility there or you can use context.

If you have more than 10 occurences

You better define rules (logic), when such special content should appear. This way you can have just one logic easily maintainable (which is your goal).

Reference on node?

One way could be, that you create a content type for this content, and add any of the node reference fields (references, relations modules,...) (in case you want to display the content on specific nodes). This way you can always assign a content to another content and then create a block view that will take the argument from current nid and pass it over so you can display all content that has a reference with the same nid or you can attach the view to the entity via eva view.

Path?

I am not seeing any module available so you will have to create your own solution. This might help to get you started

  1. Add a long text field to the content type - this field will allow you to enter path or multiple paths, one path per line
  2. Create a custom module that will be using that field to match the path by using the function drupal_match_path. You can for example create a block, that will output matched content
  3. You can place this block where you want the linked content appear (main content region, sidebar,...) via Drupal blocks UI, or context,... depends what you are using.

This could be a performance killer, if you will have a lot of content that Drupal will need to run through and see if it matches the content visibility, so you should think about some sort of caching, etc...

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.