You are here

function _pdfpreview_admin_settings in PDFPreview 7

Creates the module settings render array

If you want to extend the module's settings form, append the elements you need to the $form array. Don't forget to update the pdfpreview_uninstall() routine in the pdfpreview.install file as well.

1 string reference to '_pdfpreview_admin_settings'
pdfpreview_menu in ./pdfpreview.module
Implements hook_menu()

File

./pdfpreview.module, line 124
This file contains hooks for the pdfpreview module

Code

function _pdfpreview_admin_settings() {
  $form = array(
    'pdfpreview_pathtoimages' => array(
      '#type' => 'textfield',
      '#title' => t('Images folder'),
      '#description' => t('Path, inside files directory, where snapshots are stored. For example <em>pdfpreview</em>'),
      '#default_value' => variable_get('pdfpreview_pathtoimages', 'pdfpreview'),
    ),
    'pdfpreview_previewsize' => array(
      '#type' => 'textfield',
      '#title' => t('Preview size'),
      '#description' => t('Size of the preview in pixels. For example <em>100x100</em>'),
      '#default_value' => variable_get('pdfpreview_previewsize', '100x100'),
    ),
    'pdfpreview_description' => array(
      '#type' => 'checkbox',
      '#title' => t('Description'),
      '#description' => t('Show file description beside image'),
      '#options' => array(
        0 => t('No'),
        1 => t('Yes'),
      ),
      '#default_value' => variable_get('pdfpreview_description', 1),
    ),
    'pdfpreview_tag' => array(
      '#type' => 'radios',
      '#title' => t('HTML tag'),
      '#description' => t('Select which kind of HTML element will be used to theme elements'),
      '#options' => array(
        'span' => 'span',
        'div' => 'div',
      ),
      '#default_value' => variable_get('pdfpreview_tag', 1),
    ),
  );

  // Callback function which checks for existing preview directory on save
  $form['#submit'][] = '_pdfpreview_prepare_filesystem';
  return system_settings_form($form);
}