Hi, I'm the maintainer of the Facebook-style Statuses module (FBSS). I recently integrated FBSS with Pathauto. Just thought the maintainers would like to know that -- I know I always like to hear when other modules integrate with mine. I was pleasantly surprised at how straightforward Pathauto integration was to implement.

Cheers!

Comments

greggles’s picture

Awesome - thanks for letting us know!

Can you describe how the integration works? Was it tokens that you started to provide or some Pathauto integration specifically?

icecreamyou’s picture

Sure -- you can take a look (specifically lines 2187-2277, plus Token integration is clearly labeled a few hundred lines up, or just search for "Pathauto integration"). I already had Token integration because I was using it with Activity. But FBSS provides its own entity (the statuses) and I recently added a feature for each status to be shown on its own individual page instead of in a list via Views. The default path for each status is statuses/[status-id] but I wanted users to be able to automatically alias those pages to be whatever path suited them, for example user/[poster-id]/[status-id] like on Twitter. So I implemented hook_pathauto() (the docs for that, by the way, don't mention the "patterndescr" property of the returned object, IIRC -- I figured it out by looking at Pathauto's implementation for nodes) and hook_path_alias_types() and then wrote the bulk update function.

The only confusing part was using the $placeholders parameter of pathauto_create_alias(). The docs were wrong, and I had to dig around to realize I needed to use pathauto_get_placeholders() from pathauto.inc. I also had to look through token.module to find token_get_list(). The node implementation in pathauto_node.inc was very helpful.

greggles’s picture

Interesting - thanks for the explanation.

Any chance you could provide a patch for the bad documentation? I'll happily review/commit it!

icecreamyou’s picture

Sure, I'm pretty busy today but I'll see what I can do.

icecreamyou’s picture

Title: Facebook-style Statuses integration » Update API documentation
Category: support » bug
Priority: Normal » Minor
Status: Fixed » Needs review
StatusFileSize
new5.43 KB

I'm also not sure the last section (the "this is basically not true any more" part) needs to stay in, but I didn't remove it because I have no idea what it's talking about.

Status: Needs review » Needs work

The last submitted patch, API.patch, failed testing.

icecreamyou’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
Status: Needs work » Needs review
StatusFileSize
new10.7 KB

I'm currently in the process of updating FBSS to support Pathauto for D7... here's a patch against 7.x-1.x.

I didn't update pathauto.api.php but this patch explains the hooks in it.

dave reid’s picture

Status: Needs review » Needs work

We actually need to get rid of API.txt and be using pathauto.api.php only. The documentation needs to exist there.

dave reid’s picture

Component: Miscellaneous » Documentation
Category: bug » task
mojzis’s picture

I just ran into those historical instructions in API.txt, featuring

- hook_token_values
- hook_token_list

It gets one puzzled :) If I get it right, you would like to remove this file completely but don't want to because not all info is in api.php yet ?

Would it help if i try to move it / update it into api.php ? If i get it right, the settings hook should be advertised there, as well ?

thanks :)

mojzis’s picture

StatusFileSize
new1.34 KB

Attaching the first version of the first hook described to make sure we understand each other.

kristiaanvandeneynde’s picture

Issue summary: View changes
Priority: Minor » Normal
Status: Needs work » Needs review

Could we get the documentation in?

Currently, lines 11-15 of pathauto.api.php explain nothing. Even worse, there is still an API.txt file which contains perhaps old, incorrect information. As the module author it shouldn't be that hard to document the following two functions (one is documented in #11's patch even):

  • hook_path_alias_types()
  • hook_pathauto()
m4olivei’s picture

Assigned: Unassigned » m4olivei
StatusFileSize
new15.46 KB

I did a sweep of README.txt, combined the existing patches, moved all developer docs into pathauto.api.php and removed API.txt. I also filled out the undocumented hook and added examples in the body of the hooks where there were missing ones. Thoughts? Can someone check my work for correctness?

kristiaanvandeneynde’s picture

Looks way better to me already!

m4olivei’s picture

dave reid’s picture

StatusFileSize
new15.79 KB

Fixed a few things that PHPStorm caught like missing return value, or missing return types in phpdocs.

  • Dave Reid committed ca46f1f on 7.x-1.x
    Issue #801702 by IceCreamYou, Dave Reid, m4olivei, mojzis: Updated API...

  • Dave Reid committed ca46f1f on 8.x-1.x
    Issue #801702 by IceCreamYou, Dave Reid, m4olivei, mojzis: Updated API...
quicksketch’s picture

Status: Needs review » Fixed

This looks great!

I only noticed one small error:

+ * @see node_pathauto

Should include parenthesis:

+ * @see node_pathauto()

But that's minor. Looks like this has been committed. Thanks for writing all that up!

Status: Fixed » Closed (fixed)

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