With help of chmit coder, we make a port of this module for drupal 7 :

  • Integration with FCKeditor was removed because it is not ported to drupal 7 (CKeditor is the successor of FCKeditor).
  • The possibility to render node with 'node-embed--default.tpl.php' or 'node-embed--[type].tpl.php' has been removed.
CommentFileSizeAuthor
node_embed-7.x.tar_.gz14.52 KBvins94

Comments

vins94’s picture

Assigned: vins94 » Unassigned
Taxoman’s picture

Title: Port for Drupal 7 » D7 port of Node_Embed
Category: feature » task
aleksandar.jakovljevic’s picture

subscribe

emkamau’s picture

what is the status of this port to D7? Is this usable. Very interested in this module.

thanks

emk

vins94’s picture

Yes, this port works well.

As stated in the description, the only thing that was removed is the redesign of embedded nodes with specific templates (like 'node-embed--default.tpl.php' or 'node-embed--[type].tpl.php).

Enjoy!

mtndan’s picture

Please explain how to theme embedded nodes in Drupal 7 - is there a template override I can use?

Thanks in advance.

vins94’s picture

You also can use a custom node template in the 'templates' directory of your current theme (node--[type].tpl.php). But the render of node will be modified generally (embedded in another node or not).

mtndan’s picture

Sure I understand that, but I'd like to do an embed-specific template.

iko’s picture

Hi,

I also think it would be fine to be able to create an embed-specific template, so that we could chose what to display from the embedded node (basically, neither the title nor the $submitted). I hope this functionnality will be added in the port. Thanks in advance :-)

Anonymous’s picture

Any news on a port to D7? I' m available to help if needed on porting it.

sachbearbeiter’s picture

sub

sreynen’s picture

Status: Needs review » Reviewed & tested by the community

I've used this and it works at least well enough to have its own dev branch.

kaizerking’s picture

Issue tags: +D7

This node embed code has some problem , if it works then why not to port?

Yuri’s picture

I expect that the D7 version will look a lot like the Field Collection module. In the future, when every entity type will be able to behave as a field collection, Node Embed won't be needed any more.

jyee’s picture

+1 to create an official D7 branch with the port from this thread. It works well and is stable enough that I've used it for a live production website.

EvanDonovan’s picture

This works well, for its purposes, although it would be great if the embed-specific templates could be added back in. Can this be added as an official release?

EvanDonovan’s picture

I added code as follows to provide a custom view mode, which could serve the same purpose that the node-specific templates did, except allowing for configuration in the Drupal UI:

/**
 * Implements hook_entity_info_alter().
 * Defines a new view mode used for viewing embedded nodes, so only selected fields are shown.
*/
function node_embed_entity_info_alter(&$entity_info) {
  $entity_info['node']['view modes']['embed'] = array(
    'label' => t('Embed'),
    'custom settings' => 'TRUE',
  );
} 

Note that it may make more sense not to default this view mode to having custom settings, since not everyone will want it to be different than the default.

I also altered the processing of the filter to make use of this view mode, as follows:

/**
 * Provides the replacement html to be rendered in place of the embed code.
 * Does not handle nested embeds.
 *
 * @param $matches
 *    numeric node id that has been captured by preg_replace_callback
 * @return
 *    The rendered HTML replacing the embed code
 */ 
function _node_make_replacements($matches) {
  
    $node = node_load($matches[1]);
    
    if($node == FALSE || !node_access('view', $node) || !$node->status) {
      
      return "[[nid:{$matches[1]}]]";
    }
    else {
      
      $node->node_embedded = TRUE;
      $view = node_view_multiple(array($node->nid => $node), 'embed'); // use the special view mode for the embed code
      $render = drupal_render($view);
      
      return $render;
    }
   
}

I will submit a patch for these changes once an official release for 7.x has been made. I would be willing to maintain such a release if no one else has interest in doing so. I already have Git access.

sreynen’s picture

EvanDonovan, if you're wiling to maintain this project, I'd strongly encourage you to follow the abandoned project process. None of the current maintainers have touched this issue, so they're unlikely to see your offer. Nnor have they committed anything on the project in almost a year, so this looks like an abandoned project.

EvanDonovan’s picture

Ok, I was thinking I will need to do that. Will try to do that in the next week or so.

ericclaeren’s picture

Hi, I received some undefined index language errors after cloning a node.

Looks like I fixed this by setting a language value and when no language detected setting it to language_none (und)

/**
 * validation for the node_embed filter.
 * we do not allow nodes to embed in themselves.
 * results in segment fault.
 */
function node_embed_validate($node, $form) {
  
  if (isset($form['values']['nid'])) {
    
    $nid = $form['values']['nid'];    
    $needle = "[[nid:{$nid}]]";    
    $num = 0;
    $language = (isset($form['values']['language']) && $form['values']['language']) ? $form['values']['language'] : LANGUAGE_NONE;

    while (isset($form['values']['body'][$language][$num])) {

      $found = strpos($form['values']['body'][$language][$num]['value'], $needle);

      if ($found == TRUE) {
        form_set_error('edit-body', t('A node is not allowed to embed in itself.'));
      }
      
      $num++;
    }
    
  }
  
}

Have any of you seen this problem before and would this be a correct solution?

Thanks, Cheers

lee20’s picture

Subscribing. Would love to see a D7 branch get created soon!

mrharolda’s picture

Hmmm... 4 maintainers, but the last commit is almost 1 year ago...

Is this module abandoned?

sreynen’s picture

I've started the abandoned project process in #1431518: Offering to (co-)maintain Node Embed. That can take up to two weeks. Whenever it's done, I'll create a D7 release.

ericclaeren’s picture

Thanks sreynen!

benkoren’s picture

Subscribe.

saru1683’s picture

using pannel pages along with views, you can achieve the same feature in 7.x.
If you want, I can provide you with more information. I have done this with one of my project.

Thank you.

sreynen’s picture

Status: Reviewed & tested by the community » Fixed

I'm now maintainer. I made a D7 branch. I'll get a release up momentarily.

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