I have a little helper function for my hook_schema:
function _bbcmap_schema_asr_field($description) {
return array(
'type' => 'int',
'unsigned' => TRUE,
'size' => 'small', // Up to ~66k with MySQL (equivalent up to ~660.00 adjusted)
'not null' => FALSE,
'description' => t($description),
);
}
And then I can use it something like:
/**
* Implements hook_schema().
*/
function bbcmap_schema() {
$schema['la_data'] = array(
'fields' => array(
...
'mort_asr_male' => _bbcmap_schema_asr_field('The age standardised mortality amongst men (fixed point with scale factor 1/100)'),
'mort_asr_female' => _bbcmap_schema_asr_field('The age standardised mortality amongst women (fixed point with scale factor 1/100)'),
'incid_asr_male' => _bbcmap_schema_asr_field('The age standardised incidence amongst men (fixed point with scale factor 1/100)'),
'incid_asr_female' => _bbcmap_schema_asr_field('The age standardised incidence amongst women (fixed point with scale factor 1/100)'),
...
),
);
}
I know that the guideline is not to pass variables through t()
but this seems very similar to how the menu system passes the callback's title through t()
(by default). Any comments on this being good or bad style?