I wrote a module that adds javascript and css to a page with nodes of the type 'rower', now I need to add javascript and css to the page only if there is no tag in any of the nodes with id == 1503. I tried to do it myself, but does not work, because the variable $ containsOutletTag == TRUE only in the last node. Could you tell me how can I do this? Here is what I have now:
<? PHP function countdown_preprocess_node (& $ vars) { if($vars['type'] === 'rower') { $containsOutletTag = false; foreach ($vars['field_product_tags']['und'] as $tag) { if ($tag['tid'] == 1503) { $containsOutletTag = true; } } if (!$containsOutletTag) { drupal_add_css (drupal_get_path ('module', 'countdown'). '/src/countdown.css'); drupal_add_js (drupal_get_path ('module', 'countdown'). '/src/countdown.js'); } } }