The core Path module defines the page admin/config/search/path
which gives a listing of all path aliases.
The menu hook in the module calls the path_admin_overview
function in path.admin.inc
which makes the query to retrieve a list of URL aliases:
$query->condition('alias', '%' . preg_replace('!\*+!', '%', $keys) . '%', 'LIKE');
What I would like to do is somehow intercept this query and modify the condition in a custom module (to avoid hacking core, of course). To be more precise, I want to make it possible to extend the condition to search the source
column as well as the alias
column as indicated above.
My first thought was to intercept the Path admin listing form: path_admin_filter_form
which I have done using hook_form_alter
. I was then hoping that somehow I could override the existing submit handler or attach an second one which would call path_admin_overview
, but of course I cannot directly modify that core function.
So it seems like I would have to make my own custom copy of path_admin_overview
and modify the code inside, then have that called instead. Of course this doesn't feel right either - since if the Path module changes, the module will fall behind.
Is there some kind of hook or pattern I can employ here to modify the query in path_admin_overview
or otherwise achieve the goal indicated in bold in a standalone module?
EDIT: It looks like it could be possible if the query in path_admin_overview
was tagged (it isn't currently), see here: https://www.drupal.org/node/310077#hook_query_alter