backdrop-contrib / biblio

Manage and display lists of scholarly publications. Import from Zotero.
GNU General Public License v2.0
0 stars 5 forks source link

Code using `variable_get` expecting variables from other modules #15

Open juanolalla opened 1 year ago

juanolalla commented 1 year ago

The module is using configuration variables (through variable_get()) that are supposed to be coming from other modules (in Drupal 7), like node or i18n. We would need to review that code and replace those parts with the Backdrop config system, using the correspondent config variables from those modules or defining new ones in the Biblio module if that's what is needed.

This is a more specific follow-up from https://github.com/backdrop-contrib/biblio/issues/16, where all Biblio defined variables will be replaces with variables from config files in the module. Also, the most straightforward use cases of variables from other core modules that already have the same variable defined in a json config file (like search_cron_limit for example).

juanolalla commented 1 year ago

From includes/biblio.import.export.inc:

if (module_exists('i18n') && variable_get('i18n_node_biblio', 0) && variable_get('language_content_type_biblio', 0)) {
  $node->language = module_invoke('i18n', 'default_language');
}
juanolalla commented 1 year ago

From includes/biblio.search.inc:

$options = drupal_map_assoc(range(0, 10));
  foreach (module_invoke_all('ranking') as $var => $values) {
    $form['content_ranking']['factors']['node_rank_' . $var] = array(
      '#title' => $values['title'],
      '#type' => 'select',
      '#options' => $options,
      '#default_value' => variable_get('node_rank_' . $var, 0),
    );
  }