Attached is a patch that adds a "captain hook" to Pirate, allowing other modules to add/alter the array of pattern replacements, like so:
/**
* Implementation of hook_captian().
*/
function mymodule_captain($patterns) {
$my_patterns = array(
'%\bDrupal\b%' => 'tha Drrupal',
'%\bcommunity\b%' => 'curmmunity',
'%\bplumbing\b%' => 'depths',
);
$patterns = array_merge($patterns, $my_patterns);
return $patterns;
}
| Comment | File | Size | Author |
|---|---|---|---|
| pirate-capitan_hook.patch | 873 bytes | mlsamuelson |
Comments
Comment #1
jrglasgow commentedmlsamuelson,
One thing you might want to add to your patch - documentation for the hook.
other than that it looks good.
Comment #2
sillygwailoComment #3
sillygwailoCommitted this to both the 6.x and 7.x branches. Do we need a
returnin the example? See the pirate.api.php I committed for reference.Comment #5
sillygwailoThe hook definitely needs a return, so I've updated the API docs accordingly.