UPDATE: I know that I could accomplish this inside of a tpl.php file. But I would prefer to keep as much logic in the template.php file as possible, reserving tpl.php adjustments for markup. I have been informed that Drupal is NOT an MVC paradigm but an AOP, and I am trying to adapt to that as quickly as possible. But I feel that since I have already accomplished this IN the Template.php file that there is bound to be a 'Best Practices' way of doing this that I would like to adopt.
Currently, I have a node_field called field_unique_card. This is a Boolean field. If field_unique_card == 1 then the title of the node needs to be something like this:
$title = '* ' . $title;
The way I am currently doing it is as follows:
UPDATE: I just remembered the better way of (expr1)?(expr2):(expr3); so I updated my preprocess function.
function theme_preprocess_node(&$variables)
{
...
$variables['title'] = $variables['field_unique_card'][0]['value'] ? '*' . $variables['title'] : '';
}
I am wondering if this is 'Drupal Best Practices' or if there is a smarter way? I ask because this only affects the nodes when they are displayed as a field. But on every node display there is an additional output of the Node title that happens at the top of the page. I can't figure out how to make it so that the title shows the * there as well.
Any help would be greatly appreciated.