You are here

function _footnotes_field_admin_form in Footnotes 7.2

Same name and namespace in other branches
  1. 7.3 footnotes_field/includes/footnotes_field.admin.inc \_footnotes_field_admin_form()

Renders admin form.

Parameters

array $form: Form array.

array $form_state: The form state array.

1 string reference to '_footnotes_field_admin_form'
footnotes_field_menu in footnotes_field/footnotes_field.module
Implements hook_menu().

File

footnotes_field/includes/footnotes_field.admin.inc, line 16
Footnotes field admin file.

Code

function _footnotes_field_admin_form($form, &$form_state) {
  $content_types = _footnotes_get_content_types();
  $settings = _footnotes_field_get_settings();
  if (module_exists('ds')) {
    $form['content_types'] = array(
      '#type' => 'checkboxes',
      '#title' => t('Content types'),
      '#options' => $content_types,
      '#default_value' => !empty($settings['content_types']) ? $settings['content_types'] : array(),
      '#description' => t('Select the content types you want to enable the footnotes field for. This will expose an extra field on the "manage display" page of the selected content types. The footnotes will be stripped from the node text fields and will be added in this custom field.'),
    );
  }
  else {
    $form['content_types'] = array(
      '#markup' => '<div class="messages warning">' . t('If you want to expose the footnotes as a field you have to install <a href="!url">Display Suite</a>.', array(
        '!url' => url('https://www.drupal.org/project/ds'),
      )) . '</div>',
    );
  }
  $form['expose_block'] = array(
    '#type' => 'checkbox',
    '#title' => t('Expose footnotes as block'),
    '#default_value' => !empty($settings['expose_block']) ? $settings['expose_block'] : 0,
    '#description' => t('This will expose a block which you can add on a node detail page. The footnotes will be stripped from the node text fields and will be added in this block.'),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save settings'),
  );
  if (module_exists('ds')) {
    $form['info'] = array(
      '#markup' => '<div class="messages warning">' . t('Saving this form will clear all caches to expose a Display Suite field.') . '</div>',
    );
  }
  return $form;
}