Skip to main content
Notice removed Draw attention by CommunityBot
Bounty Ended with sanzante's answer chosen by CommunityBot
added 21 characters in body
Source Link
njp
  • 737
  • 2
  • 10
  • 29

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

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, see here: https://www.drupal.org/node/310077#hook_query_alter

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

Notice added Draw attention by njp
Bounty Started worth 50 reputation by njp
added 152 characters in body
Source Link
njp
  • 737
  • 2
  • 10
  • 29

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, see here: https://www.drupal.org/node/310077#hook_query_alter

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?

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, see here: https://www.drupal.org/node/310077#hook_query_alter

Source Link
njp
  • 737
  • 2
  • 10
  • 29

How can I modify the result of the core Path listing filter?

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?