0

I have a lot of content migrated over from a legacy CMS. All of the nodes have some value, but there were a lot of entries that don't need more than for their information to show up in the long lists (They don't need individual node pages). Let's call the three fields that need checking:

  • abstract
  • related_websites
  • public_files

What would be the best way to set it up so that if abstract is empty, and the multiple entry allowed related_websites and public_files both have no entries, that the entry still be listed, but there be no link to the full node.

I'll need to do this all over the place, from search results to listings by date and by content type, so the easier it is to implement the better. Would this be better done in a theme or a module?

1 Answer 1

2

This is probably one of those questions that might fall under opinion-based, but I'll give my answer.

The answer really depends on your needs. It comes down to the question, does stub content impact display or workflow (editing, moderating, viewing, etc.) around the content? In either case, you'll want a centralized piece of logic (e.g. mytheme_is_stub() or mymodule_is_stub() function) that determines if the content meet your stub criteria.

If it impacts just the display then you want a theme; you can use your centralized logic to determine when/where to alter rendering of content.

If it impacts the workflow (e.g. you want to prevent an author from creating stub content or alert them about stub content) then you want a module; you can use your centralized logic to determine when/where to alter workflow around the content.

From your description (altering links, search display, etc.), it sounds like your only concern is display, if that's the case then you want a theme.

5
  • I'd be happy to edit the question down to something less opinion based, its just that I'm really not sure where to start with this, and your answer is helpful. In general, you are right, the display is the primary concern. It would be nice to be able to pop up a warning when users submit an entry that will only show up as a stub, but there are legitimate reasons for doing so, so I wouldn't want to prevent them entirely. The issue I've had previously, was that at the field preprocess level I didn't have access to the other fields, and at node level, it seemed too late to modify fields.
    – UltraBob
    Apr 19, 2016 at 3:04
  • I'd just leave it at that. There's probably not much more to mention here; you could narrow the question to just module vs theme, but that'd probably be flagged as too broad; without knowing every current/future requirement you can't definitely answer the question.
    – Shawn Conn
    Apr 19, 2016 at 3:55
  • Is there any overarching way of telling drupal that an item in a list shouldn't be linked or does it require going in and modifying each piece of the display where there might be a link present? The renderable array setup must make it easier for people who have gotten used to it, but for me it has been constant headesking so far. Make a change to an array, and watch it have no effect on anything, repeat.
    – UltraBob
    Apr 19, 2016 at 4:02
  • Well, if your list being by rendered by a theme function (e.g. theme_links) then you can override it at the theme template level. Or you could try to override things at link render level (i.e. theme_link ).
    – Shawn Conn
    Apr 20, 2016 at 0:46
  • I ended up removing the links from the title using hook_node_view. Thanks for your help on this.
    – UltraBob
    Jun 10, 2016 at 1:01

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.