I just stared using the Node Embed module and I love it!

What I'm missing though is an easily usable way to edit embeded nodes. I figured I'd solve this problem by adding some markup for a privileged edit link through a custom embeded node template file within my theme. Following the brief guidelines in the module overview page, I made a new file node-embed--default.tpl.php that has the same content as my node.tpl.php in my theme. My new file is in the same location as node.tpl.php which (for my custom theme from the Basic base theme) is sites/all/themes//templates. I then made a small change to the markup in this new node-embed--default.tpl.php file, expecting to see that change propagate to my test page with a working embeded node.

The problem is that I can't, for the life of me, get my custom template for embeded nodes to work. I can make changes to other templates and they show up fine. I've tried refreshing the cache, clearing the theme registry, and also tried many differnet names for this custom template such as: "node-embed--default.tpl.php", "node-embed-default.tpl.php", "node-embed.tpl.php", and so forth. File permissions seem fine. What else can I check/do here to get my custom embeded node template file working?

Or, is there an easier way to go about adding edit links to my embeded nodes.

PS: When I say edit links, what I mean is that users with permission to edit the embeded node will get an edit link that shows up when hovering over the embeded node (I can take care of the css part here, but I just can't get the markup inserted).

Comments

sreynen’s picture

Title: How to make a custom template for an embeded node » Document how to make a custom template for an embeded node
Version: 7.x-1.0-rc1 » 7.x-1.x-dev
Category: support » task

The template names are different for D7, but the documentation isn't updated yet. The file should be named either node--node_embed.tpl.php for all node embeds or node--type--node_embed.tpl.php for a node type named "type." So basically, you just add "--node_embed" onto whatever your node template would be normally.

I'm leaving this open as a documentation task.

sreynen’s picture

This is now covered on the new documentation page.

sreynen’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

figureone’s picture

Status: Closed (fixed) » Active

In Drupal 7, isn't this node--node-embed.tpl.php, not node--node_embed.tpl.php? (dash instead of underscore.)
In my testing, this seems to be the case.

figureone’s picture

A little clarification: I had problems getting the default node embed template file to work with the underscore. But a template file for a specific content type worked on with the underscore.

In other words, these worked in my theme directory:
node--node-embed.tpl.php
node--content_type_name--node_embed.tpl.php

This did not:
node--node_embed.tpl.php

gmclelland’s picture

mrharolda’s picture

Status: Active » Closed (fixed)

Thank you for your tutorial on node embed, gmclelland!