You are here

function biblio_locale_refresh_fields in Bibliography Module 7

Same name and namespace in other branches
  1. 6.2 biblio.module \biblio_locale_refresh_fields()
  2. 6 biblio.module \biblio_locale_refresh_fields()
  3. 7.2 biblio.module \biblio_locale_refresh_fields()

Refresh all translatable field strings.

Parameters

int $tid: Biblio publication type id whose field strings are to be refreshed. If not specified, strings for all fields will be refreshed.

2 calls to biblio_locale_refresh_fields()
biblio_admin_types_edit_form_submit in includes/biblio.admin.inc
Form handler for biblio_admin_types_edit_form.
biblio_locale in ./biblio.module
Implements hook_locale().

File

./biblio.module, line 93
Bibliography Module for Drupal.

Code

function biblio_locale_refresh_fields($tid = NULL) {
  if (function_exists('i18n_string')) {
    if (isset($tid)) {
      $result = db_query('SELECT d.* FROM {biblio_field_type} b INNER JOIN {biblio_field_type_data} d ON b.ftdid = d.ftdid WHERE tid = :tid', array(
        ':tid' => $tid,
      ));
    }
    else {
      $result = db_query('SELECT * FROM {biblio_field_type_data}');
    }
    $options = array(
      'translate' => FALSE,
      'update' => TRUE,
    );
    foreach ($result as $row) {
      i18n_string("biblio:field:{$row->ftdid}:title", $row->title, $options);
      i18n_string("biblio:field:{$row->ftdid}:hint", $row->hint, $options);
    }
  }
}