My module adds further content to a specific node bundle, in the "view" phase, in the following way:
hook_view
(under the right conditions) adds these "contents" to the nodedisplay
arrayhook_theme
specifies how to render the possible render_array related to the added contents
I followed several tutorials about, and in effect the documentation (of the latter) reports:
The structure of $node->content is a renderable array as expected by drupal_render().
Here is an abstract from my code:
/**
* Implements hook_view().
* Remember: hook prefix is based on the base of the node type (node-type-specific hook)
*/
function mynode_view($node, $view_mode) {
$contentWrapper = entity_metadata_wrapper('node', $node);
$myfield = $contentWrapper->myfield->value();
if ($view_mode=="full") {
$node->content["ds_column"] = array(
'#markup' => theme('ds_column', array(
'element' => _mymodule_to_render_arrays($myfield, $node->status),
)),
'#weight' => 150,
);
}
return $node;
}
As you can see this adds the ds_column
to my node content, telling me it has to be rendered by a theme function.
It also passes to the theme function a "render array" (containing the information to be rendered).
/**
* Implements hook_theme().
*/
function mymodule_theme($existing, $type, $theme, $path) {
return array(
'ds_column' => array(
// See http://drupal.org/node/224333#theme_changes
'variables' => array('element' => NULL),
'template' => 'theme/ds_column'
),
);
return $theme;
}
This part of my module explain what template file have to be used in order to properly render, in the node (bundle) page, the content I added by the previous hook.
For what I see this is the standard approach. And indeed everything works fine.
The problem description starts here.
The module I described has been installed on an environment using the Display Suite module to define how to show contents for each node type in the node page, but the Display Suite module doesn't allow to see, in the configuration page, the content I added with the code shown above. So now that content doesn't appear in the node page.
I would like just to see the "ds_column" in the Display Suite configuration page for that specific node, in order to place it properly.
I can't figure how to see it (have I to implement also a DS hook? Have I to modify my code in some way?). I just found the "Display Suite Extra" sub-module, but I wasn't able to solve by it.