Per-Group Overrides

gcassie - January 23, 2009 - 15:10
Project:String Overrides
Version:6.x-1.7
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs review
Description

I had a project (now abandoned) where string overrides were to be managed on a per-group basis. The idea was to use the nid in place of the language code. Here is about as far as I got; its just proof of concept at this stage, but it works.

<?php
function og_stringoverride_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
 
 
// okay the concept works. next steps would be:
  // add a UI on a per-node level
  // figure out how to propagate parent overrides to children in a sub-group setup
  // create a new table to store this in. it could get out of hand if the
  //    variables is used. load in those values here.
  // what impact does this have on multi-lingual sites?
 
 
global $language;
  global
$conf;
 
  if (
$op == 'load' && $language->language == 'en') {
   
$language->language = $node->nid;
   
$conf['locale_custom_strings_1'] = array('My Unread' => 'Unread that is mine');
  }
}
?>

I wanted to do this for a site where there were dozens of system strings that were generally the same from group to group, but would sometimes need to be tweaked on just one. I thought this would be a nice way to handle it instead of adding dozens of CCK fields or the like.

Hope someone finds this concept useful.

 
 

Drupal is a registered trademark of Dries Buytaert.