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.

CommentFileSizeAuthor
faq-rename_body_label.patch645 bytesapower

Comments

stella’s picture

Status: Needs review » Fixed

Good spot! Patch committed, many thanks!

apower’s picture

Glad to help!

stenjo’s picture

The patch did not seem to have been committed properly. See #1567312: Fails install + Simpletests failing that fixes the missing code lines.

Status: Fixed » Closed (fixed)

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