Closed (fixed)
Project:
Frequently Asked Questions
Version:
7.x-1.0-rc2
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
30 Apr 2012 at 15:29 UTC
Updated:
22 May 2012 at 19:50 UTC
After reviewing the code, it looks like the intended functionality was to use the label "Answer" on the body field, as seen from line 196 of faq.module:
function faq_node_info() {
return array(
'faq' => array(
'name' => t('FAQ'),
'base' => 'faq',
'description' => t('A frequently asked question and its answer.'),
'title_label' => t('Question'),
'body_label' => t('Answer'),
),
);
}
...but when I installed the module, the body label still says "Body."
After a little bit of research, I found a simple solution. This label assignment can be made from faq.install file instead.
Original:
function faq_install() {
variable_set('node_type_faq', array('status'));
// Ensure the FAQ node type is available.
node_types_rebuild();
$types = node_type_get_types();
node_add_body_field($types['faq']);
}
Proposed Update:
function faq_install() {
$t = get_t();
variable_set('node_type_faq', array('status'));
// Ensure the FAQ node type is available.
node_types_rebuild();
$types = node_type_get_types();
node_add_body_field($types['faq']);
// Change the default label on the body field.
$body_instance = field_info_instance('node', 'body', 'faq');
$body_instance['label'] = $t('Answer');
field_update_instance($body_instance);
}
I attached a patch that should do the trick.
| Comment | File | Size | Author |
|---|---|---|---|
| faq-rename_body_label.patch | 645 bytes | apower |
Comments
Comment #1
stella commentedGood spot! Patch committed, many thanks!
Comment #2
apower commentedGlad to help!
Comment #3
stenjo commentedThe patch did not seem to have been committed properly. See #1567312: Fails install + Simpletests failing that fixes the missing code lines.