How to only attach OR create content type in node relativity, not both?!

storbaek - June 12, 2007 - 07:56

The link block show both 'attach' and 'create new' nodes options. But what if you want only the 'attach' options to shown for one content type and 'create new' option for another content type? Any snippets around?

Example:
Mother (parent) and Daughter (children) setup using node relativity. From the mother node you can create a daughter and from the duagther you'll see the link to who's the mother. That's ok!

What if you from another content type, let's say 'family', want to attach a mother or daughter and not create one?! And similar from the mother, how can you attach a family without the ability to create a new family?

Override theme_relativity_block_link_operations

markusH - June 12, 2007 - 09:52

Hi sorbaek,

I actually haven't done this before, but maybe a pointer in the right direction: By the look of it you should be able to override the theme_relativity_block_link_operations in your theme's template.php file (see http://drupal.org/node/55126 for details) and insert some logic there.

cheers
markus

Override theme_relativity_block_link_operations

markusH - June 12, 2007 - 09:53

Hi sorbaek,

I actually haven't done this before, but maybe a pointer in the right direction: By the look of it you should be able to override the theme_relativity_block_link_operations in your theme's template.php file (see http://drupal.org/node/55126 for details) and insert some logic there.

cheers
markus

Adding the function gave me a blank page!!!

storbaek - June 12, 2007 - 11:16

I really want to try what you suggested, so I wanted to output the function in a block before trying to find a logic to customize it. Here is what I did:
1) Added a custom block with the function
2) Changed input format to php and saved the block

Now, all my pages are blank except the update.php. Running update.php or moving the relativity folder from /modules does does not work. I'm now stuck with a blank page and cannot do anything!!! Somehow, I need to remove this block, but I cannot open the pages...!

This error is shown when I run update.php:

user warning: Table 'myloc3_mysql.relativity_access' doesn't exist query: SELECT nid FROM relativity_access WHERE uid = 1 in C:\Drupal\includes\database.mysql.inc on line 172.

user warning: Table 'myloc3_mysql.relativity_access' doesn't exist query: SELECT * FROM relativity_access WHERE nid = 307 in C:\Drupal\includes\database.mysql.inc on line 172.

Back to business - need to identify logic for the function!

storbaek - June 12, 2007 - 12:41

I managed to delete the damn block from the database table called boxes, so everything is back to normal. I did not have 'print' before the function, which caused my error.

I was reading the page http://drupal.org/node/55126, and I'm starting to learn a new territory. However, I cannot figure out what commands I can use to tweak this function to so it only prints 'attach' OR 'create'?

<?php

print theme_relativity_block_link_operations($node);
?>

 
 

Drupal is a registered trademark of Dries Buytaert.