From my custom module I'd like to target essentially all front end pages on my site whether it be a node, front page, a views page or taxonomy page. I started out thinking it would be better to use logic that said if not admin or node edit / add but did not seem to have much luck. I came up with this and it seems to work fine but I don't know if accounts for every possible front end type of page that I have mentioned.
function mymodule_page_build(&$vars) {
// Global node.
$node = menu_get_object ();
// Target front end pages
if ((!empty($node) && arg(2) === null) || (drupal_is_front_page())) {
// do stuff
}
}
I have a feeling the code does not account for all possible conditions I have mentioned so I am looking for some suggestions. I was thinking to exclude by path would be good except that node edit and node add don't have /admin in the url.
Note: By Target, I simply mean to focus or act upon. Example: If you want to add javascript or css to a specific page or pages from a module, you are "targeting" those pages.