In the "Automatic Title Generation" fieldset on a content type, there is a check box which can be checked to "Evaluate PHP in pattern." Immediately below this check box it states, "Put PHP code above that returns your string, but make sure you surround code in <?php and ?>. Note that $node is available and can be used by your code."

This is exactly what I needed, except for one issue -- I found that only node values are loaded in $node, not node views. This is an issue for any CCK field where the value and display options are different. For example, a select CCK field with the following options:

1|John
2|Joe
3|Mary
4|Ann

In this situation, I will only have the ability to display "1, 2, 3, or 4" in the title, not "John, Joe, Mary, or Ann". I was able to correct this problem by loading the views using the following code:

$bc = node_load($node->nid);
node_invoke_nodeapi($bc, 'view');

Would it be possible to add the node_invoke_nodeapi for "view" to the module code so we can have access to both values and views? Stating that "$node is available" is misleading if view data cannot be obtained.

Comments

jdeg’s picture

I have the same problem...

manish-31’s picture

Issue summary: View changes
Status: Active » Closed (outdated)