Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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 CreditAttribution: 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
return
in 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.