Hey,
I am trying to configure a rule set to set the node's title with rules, for updated and new content. The ideal title can be set with the use of a token and some custom php code. The idea is the title would look something like this:
[node: (cck_field)] code. The problem is, my code is too long for the field title box. The reason my code is long is I need to extract the taxonomy values from two arrays from freetagging, so the title can appear as [cck title]-tag-tag1-tag2-tag3-tag4-tag5 and so on. I have written the code to extract the items from the $node->tags array and sub-arrays, but it's too long to put in the title box.
My code is here:
<?php
foreach ($node->tags as $key => $value) {
foreach ($node->tags[$key] as $k => $v) {
print $node->tags[$key][$k]->name.'-';
}
}
?>
I can't fit all of that code into the title box, and I can't shorten it to the best of my ability (which isn't saying much, considering I'm very much a beginner in php). I tried making a custom module and tossing that code in a function, but the problem with that is, I don't have access to the $node object, so calling the custom-defined function does nothing. So, in short, how can I allow that textfield to accept more characters while generating the title? Is it set within rules module, or is it set in post settings title or some other drupal setting? If it's done within rules, which .module or .inc file creates the $form array which sets the #maxlength property so I can expand it (I don't mind hacking the module, god knows I do it all the time).
Any suggestions?
Thanks in advance!
Comments
Comment #1
rc2020 commentedUpdate:
I created a module with a function that allows me to return the taxonomy values properly. The code for my module is here:
That function works great when called in content template, so I know it works. However, it does not seem to work when used in setting the title for the node. Rules says the $node object is available to me, but when I put that function in, it doesen't seem to work. Is there some obvious reason for this? Perhaps rules is evaluating the code before the taxonomy values are put in the $node->tags array? I'm unsure but I'd really appreciate any thoughts on how to get to the bottom of this.
Thanks!
Comment #2
mitchell commentedPlease create a new issue for your support request; I understand the inconvenience, but it will help in maintaining the issue queue.
Marking as duplicate of #448922: Make recipient input expandable because of original post.