I have a couple of custom content types in my theme...for example, a page with two columns, with separate input boxes for each. One uses the default Drupal 'body', and another a custom field of 'field_left_column'. In my 'template.php' file, I have this function:
function newbie_preprocess_page(&$variables) {
if (arg(0) == 'node') {
$variables['node_content'] =& $variables['page']['content']['system_main']['nodes'][arg(1)];
}
if (isset($variables['node']->type)) {
$variables['theme_hook_suggestions'][] = 'page__' . $variables['node']->type;
}
}
And then in the tpl file for this template, I use the following to display the two fields (leaving out my containers):
if (isset($node_content) && $node_content['field_left_column']) {
print render($node_content['field_left_column']);
}
if (isset($node_content) && $node_content['body']) {
print render($node_content['body']);
}
What I cannot figure out is how to attach the contextual edit menu to allow editing. Is there a simple call I can make, or do I need to write a function, create a contextual.tpl file, and so on? None of the results from my searching make sense to me, but that could just be a complete lack of brainpower on my part.
I apologize if any of my terms are not correct, I'm relatively new to drupal dev. Please let me know if the way I'm approaching this is totally bogus and what I should be doing instead.
Comments
I wonder
if this post will help you: http://dominiquedecooman.com/blog/drupal-7-tip-add-contextual-links-anyt...
Looking to Migrate from Drupal 6/7 to Drupal 10/11? Have a look at our Drupal 11 demo site and request access.