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.
On the beginning of the module file there are variables which are declared directly in file, which using t() function.
It's not good idea to to that.
global $_feedjit_color_names, $_feedjit_schemes;
$_feedjit_color_names = array('bc', 'tc', 'brd1', 'lnk', 'hc');
$_feedjit_schemes = array( // in color.module format
'#FFFFFF,#494949,#336699,#494949,#336699' => t('Feedjit Neutral'),
'#E8F6BE,#666666,#C4C4C4,#666666,#7F7F7F' => t('Feedjit Green'),
...
);
During loading the files, module making mysql access and slowing down loading process and some functionality can be not available in this time (like caching, other handling, etc).
It's better to move this code into init or boot hook.
Like:
/**
* Implementation of hook_init().
*/
function feedjit_init() {
global $_feedjit_color_names, $_feedjit_schemes;
$_feedjit_color_names = array('bc', 'tc', 'brd1', 'lnk', 'hc');
...
}
Comments
Comment #1
lyricnz CreditAttribution: lyricnz commentedTrue. If I was going to start messing around with this module, I should probably add:
- fetch colorsets in a hook, allowing other modules to add new alternatives
- allow user-configurable colorsets
Comment #2
kenorb CreditAttribution: kenorb commentedComment #3
kenorb CreditAttribution: kenorb commented