Nodecode

Categories

Component ID

2442015

Component name

Nodecode

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Component created

Component changed

Component body

What

Node code is an extension of the shortcode module. It allows injection of a new shortcode [nodecode]. This injects a node of a given nid into the content and can be rendered with any view mode.

Why

This module is primarily useful because shortcode uses Drupal's text formats, it will parse and cache body text using whatever theme first asks for that node. This is problematic when you use modified tpl files in your site's theme as the text formats will render your node and cache its body using the admin theme if that is where a browser first loads the node after a cache clear (like the admin/content page). There are two issues related to this on the shortcode issue tracker:

https://www.drupal.org/node/2247487 (mine)
https://www.drupal.org/node/2153235

This module circumvents this problem by re-parsing the field value rather than the text format.

Use

After installing, enable nodecode like any other shortcode under Admin > Config > Text Formats > { your format } > Configure > Shortcodes. The shortcode should be used like this:

[nodecode nid='xxx' /] // default viewmode is teaser
[nodecode nid='xxx' viewmode='full' /]

Future

This is a simple module with simple ambitions. I'll try to fix any bugs, but probably won't be looking to expand the feature set too much.