So when you supply modifiers through hook_purl_modifiers() these values get cached, which is probably a good thing since this map is called so often. However I'd love to try and make modifier strings translatable (e.g. pass value through the t() function).

At the moment I'd have to manually add each translation manually into the array.

However maybe the translation should happen in the url rewriting instead? Just wondered what people's thought were on this. I'll continue to have a play.

CommentFileSizeAuthor
#1 patch_commit_976ae603c99a.patch871 bytesjdelaune

Comments

jdelaune’s picture

StatusFileSize
new871 bytes

Here's my solution. Basically it creates a cache of modifiers per translation, so if you only have one translation you won't get a performance hit, but it adds that flexibility if needed.

/**
 * Implements hook_purl_modifiers().
 */
function departments_purl_modifiers() {
  return array(
    'departments' => array(
      array('value' => t('creative'), 'id' => 1),
      array('value' => t('finance'), 'id' => 2),
    ),
  );
}
jdelaune’s picture

Status: Active » Needs review
tobby’s picture

Status: Needs review » Reviewed & tested by the community

Patch tested and committed for beta 1.

tobby’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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