This would be the following hooks

hook_path_insert()
hook_path_update()
hook_path_delete()

In modules/path/path.api.php. The inline comments are pretty crappy too and could definitely use some work.

Comments

dave reid’s picture

Subscribing, this was pointed out in an issue that I've been working on and has been pushed to D8. This should still make it in.

dave reid’s picture

Issue tags: +Novice

Adding tag....

gdd’s picture

Issue tags: -Novice

Untagging since this isn't actually really a novice issue.

gdd’s picture

Status: Active » Needs work
StatusFileSize
new5.76 KB

This is a cleanup of the docblock comments which were really poor. I don't have enough context on this to do the function bodies so I'll leave that for Dave Reid

gdd’s picture

StatusFileSize
new1.06 KB

Reposting since that last patch was a total bust.

gdd’s picture

StatusFileSize
new1.14 KB

Added function placeholder for delete hook, dave is looking into update and insert

dave reid’s picture

I think we just may have to do the same thing, like we do with hook_node_insert() and hook_node_update(). Been trying to think of something useful that can be understood with minimal context and am failing.

gdd’s picture

StatusFileSize
new1.8 KB

and here is your garbage function patch!

gdd’s picture

Status: Needs work » Needs review
gdd’s picture

StatusFileSize
new1.81 KB

Fixing dumb spacing

dave reid’s picture

Status: Needs review » Needs work
+++ modules/path/path.api.php	3 Oct 2010 05:57:21 -0000
@@ -13,30 +13,49 @@
+  $query = db_insert('mytable')
+    ->fields(array(
+      'foo' => 'bar',
+      'pid' => $path['pid'],
+    ))

Let's remove $query = here. We should probably also use something like $path['alias'] rather than 'foo' => 'bar'.

+++ modules/path/path.api.php	3 Oct 2010 05:57:21 -0000
@@ -13,30 +13,49 @@
- *   The path array.
+ *   The path thaat has been updated.

thaat = that

Powered by Dreditor.

gdd’s picture

Status: Needs work » Needs review
StatusFileSize
new1.4 KB
dave reid’s picture

Status: Needs review » Needs work

One more small typo.

+++ modules/path/path.api.php	3 Oct 2010 17:28:18 -0000
@@ -13,30 +13,49 @@
+  db_update('mytable')
+    ->fields(array('alias' => $ptah['alias']))
+    ->condition('pid', $path['pid'])
+    ->execute();
 }

$path <> $ptah

Powered by Dreditor.

gdd’s picture

Status: Needs work » Needs review
StatusFileSize
new1.4 KB

I'm the worst core patcher ever!

duellj’s picture

Status: Needs review » Needs work

I would give a little bit more info about the $path param and what the array contains. Seems like the definition in path_save() would be good:

 * @param $path
 *   An associative array containing the following keys:
 *   - source: The internal system path.
 *   - alias: The URL alias.
 *   - pid: (optional) Unique path alias identifier.
 *   - language: (optional) The language of the alias.
duellj’s picture

Status: Needs work » Needs review
StatusFileSize
new1.93 KB

Added full $path parameter definitions from #15. Should be good to go now.

jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

Looks reasonable to me! Thanks juellj and hejrocker.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Looks great.

Committed to HEAD. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.