I want to add some custom checks to all of my Drupal pages (except the administration pages).
I am using Bartik theme that comes with Drupal 7.26
I added the custom check in node.tpl.php and the check worked for all urls of type /node/%
However, I also want to add this check for node add, edit and delete pages.
I cannot do this.
What I have already tried:
-> Creating a node--add.tpl.php in bartik folder and adding check there.
-> Creating a custom module, and using hook_menu to route /node/%/id to a custom page.
-> Adding this function
function bartik_preprocess_page(&$vars, $hook) {
if ((arg(0) == 'node') && (arg(1) == 'add' && arg(2) == 'product')) {
$vars['template_files'][] = 'node-add-product';
}
}
in my bartik template.php file. After adding this function I created node-add-product.tpl.php file and added check there.
For all the methods I have tried, the node creation page does not change at all.
I also tried creating page--node--add.tpl.php. Then the custom check works. But the header, footer, and sidebars disappears. (Only node creation template is rendered)