(I'm sorry if this title is technically wrong, I'll do my best to explain.)

After I added a Node ID argument on the Context configuration screen, I am currently able to add the following node related panes to my display:

- Attached files
- Comment form
- Content field
- Node comments
- Node content
- Node type description

I would like to be able to add a pane with the node's links. So I can eg. add a pane next to my node's content with the comments' link, forward link, ... whatever link is in $links.

Is this possible? If so, how would this work?

CommentFileSizeAuthor
#9 node_links.inc_.patch1.87 KBsarvab
#3 node_links.inc_.txt1.96 KBbrunodbo

Comments

sdboyer’s picture

It ought to be possible, it'd just require the addition of some code to one of the node content type .inc files. My hunch is that it'd be pretty simple to accomplish via an invocation of hook_link. Line 691 in node.module has an example to work from:

function node_view($node, $teaser = FALSE, $page = FALSE, $links = TRUE) {
  $node = (object)$node;

  $node = node_build_content($node, $teaser, $page);

// line 691 begins here, at this if statement:
  if ($links) {
    $node->links = module_invoke_all('link', 'node', $node, $teaser);

    foreach (module_implements('link_alter') AS $module) {
      $function = $module .'_link_alter';
      $function($node, $node->links);
    }
  }

It ought'nt be too hard to put together, and if it's done simply and cleanly, I see no reason why we shouldn't add it to the set of content types included with panels. However, I can't promise that I'd have time to get to it, so your best bet would be to roll a patch and post it here. If you do, I'll have a look and commit it for beta4 if it works.

brunodbo’s picture

Cool, thanks for the hints. I'll work on this during the weekend.

brunodbo’s picture

Status: Active » Needs work
StatusFileSize
new1.96 KB

The attached code doesn't work yet, but it's as far as I get at this time:

I'm able to add a new pane, but the pane doesn't contain anything yet. I guess the problem lies with $block->content: I'm not sure how to get the node's links in that variable. Pointers greatly appreciated.

summit’s picture

Subscribing, did you get it working?
Greetings, Martijn

brunodbo’s picture

Not yet. I'm currently using the following workaround:

1) I added a 'Node content' pane.
2) Gave the pane an identifier & ticked the 'Display links' box (both in the pane dialog).
3) Put a simple if-check in my node.tpl.php, checking on that identifier, and printing $links in the if-statement.

This may not be the most 'durable' solution, but it does the job for me at the moment. I have been wanting to try to finish the .inc file (and will at some point), but don't have much time lately.

nrasmus’s picture

subscribing

Would you mind sharing your if statement?

In the long term, it would be great to have the ability to individually segregate out the links using the panels UI. For instance, to put the "Share" link in one place, the "add comment" link elsewhere, etc.

joachim’s picture

+1
Subscribing.

brunodbo’s picture

As a follow-up to #5, I'm using the following if statement in my node-*.tpl.php. (I'm printing individual cck fields instead of $content, I removed that for clarity's sake. I'm using the same method to print $terms in a seperate pane.)

<?php if ($node->panel_identifier == 'content_pane') { ?>

  <?php print $content; ?> 

<?php } elseif ($node->panel_identifier == 'links_pane') { ?>
  
  <?php print $links; ?>      
  
<?php } elseif ($node->panel_identifier == 'terms_pane') { ?>
  
  <?php print $terms; ?>
  
<?php } ?>

(Again: I consider this a workaround, it might not be the best way to do things.)

sarvab’s picture

StatusFileSize
new1.87 KB

Here is an updated version of this patch that should work. All that was really needed was running the resulting links that you got through the 'links' theme. This is very basic and no extra configuration options, but it does let you add node links to a panel simply.

sarvab’s picture

On reflection, I noticed this issue is for Drupal-5. The above patch was run and created against Drupal-6.2.x-dev but the code looks to be exactly the same so I assume it should work in D5 as well.

Should a separate issue be created for the patch to be included in D6?

ChrisBryant’s picture

Version: 5.x-2.0-beta3 » 6.x-2.x-dev
Status: Needs work » Needs review

Updating the status and version on this...

socialnicheguru’s picture

subscribing

sun’s picture

Status: Needs review » Needs work

IMHO, this should be part of the "Node meta data" content-type, as proposed in #279723: Add node meta data content-type.

merlinofchaos’s picture

Status: Needs work » Closed (won't fix)

Panels 2 is no longer available and is unsupported. Marking all Panels 2 issues won't fix.