Skip to content

Instantly share code, notes, and snippets.

@skwashd
Created May 7, 2016 18:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skwashd/601ec44d44a1dfeb315f44e6c7171397 to your computer and use it in GitHub Desktop.
Save skwashd/601ec44d44a1dfeb315f44e6c7171397 to your computer and use it in GitHub Desktop.
preprocessor example
<div>
<?php print $name_of_var; ?>
</div>
<?php
/**
* Implements template_preprocess_node().
*/
function mytheme_preprocess_node(&$variables) {
if ('blog' == $variables['type']) {
mytheme_preprocess_node_blog($variables);
}
}
function mytheme_preprocess_node_blog($variables) {
$variables['name_of_var'] = filter_xss($block_var);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment