I've developed a custom block which relies on a taxonomy term ID being present in the URL, otherwise it throws a 404.

I've placed this block in a panel page (ctools pages), but now when I try to edit the panel page, I get a 404 response, but only on the "Content" tab of the panel page variant.

What's the proper method for knowing you're on an admin page, or in the context of a panel edit, so that I can skip throwing a 404?


Looks like I just need to call path_is_admin

if (!path_is_admin(current_path())) {
  drupal_exit(); // This is needed if we call drupal_not_found() from hook_block_view()
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.