You are here

function biblio_citeproc_csl_editor in Bibliography Module 6.2

Same name and namespace in other branches
  1. 7 modules/CiteProc/biblio_citeproc.admin.inc \biblio_citeproc_csl_editor()
  2. 7.2 modules/CiteProc/biblio_citeproc.admin.inc \biblio_citeproc_csl_editor()
1 string reference to 'biblio_citeproc_csl_editor'
biblio_citeproc_menu in modules/CiteProc/biblio_citeproc.module

File

modules/CiteProc/biblio_citeproc.admin.inc, line 478

Code

function biblio_citeproc_csl_editor($form_state, $style) {
  $csl = db_fetch_object(db_query("SELECT id,parent,csl FROM {biblio_citeproc_styles} WHERE filename = '%s'", array(
    ':id' => $style,
  )));
  if (!isset($csl->csl)) {
    drupal_set_message(t('Biblio-CiteProc could not fetch the style file: !csl_id from the database. Check your CiteProc settings.', array(
      '!csl_id' => $style,
    )), 'error');
    return;
  }
  if (!empty($csl->parent)) {
    $csl = db_fetch_object(db_query("SELECT id,csl FROM {biblio_citeproc_styles} WHERE id = '%s'", array(
      ':id' => $csl->parent,
    )));
  }
  if (isset($csl->csl)) {
    $csl_file_contents = $csl->csl;
  }
  $form['editor'] = array(
    '#title' => t('Editing %style', array(
      '%style' => $style,
    )),
    '#type' => 'textarea',
    '#rows' => 40,
    '#format' => 'csl',
    '#default_value' => $csl_file_contents,
  );
  $form['save'] = array(
    '#value' => t('Save'),
    '#type' => 'submit',
  );
  $form['cancel'] = array(
    '#value' => t('Cancel'),
    '#type' => 'submit',
  );
  $form['style'] = array(
    '#value' => $style,
    '#type' => 'hidden',
  );
  $form['id'] = array(
    '#value' => $csl->id,
    '#type' => 'hidden',
  );
  return $form;
}