You are here

function pdfpreview_admin in PDFPreview 7.2

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'
pdfpreview_menu in ./pdfpreview.module
Implements hook_menu()

File

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

Code

function pdfpreview_admin() {
  $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>. You must set this to a value big enought to apply your image styles.'),
      '#default_value' => variable_get('pdfpreview_previewsize', PDFPREVIEW_DEFAULT_SIZE),
    ),
    'pdfpreview_quality' => array(
      '#type' => 'textfield',
      '#size' => 3,
      '#maxlenght' => 3,
      '#title' => t('Image quality'),
      '#field_suffix' => '%',
      '#description' => t('Image extraction quality in percentage.'),
      '#default_value' => variable_get('pdfpreview_quality', PDFPREVIEW_DEFAULT_QUALITY),
    ),
    'pdfpreview_filenames' => array(
      '#type' => 'radios',
      '#options' => array(
        PDFPREVIEW_FILENAMES_MACHINE => t('Filename hash'),
        PDFPREVIEW_FILENAMES_HUMAN => t('From pdf filename'),
      ),
      '#default_value' => variable_get('pdfpreview_filenames', PDFPREVIEW_FILENAMES_MACHINE),
      '#title' => t('Generated filenames'),
      '#description' => t('This changes how filenames will be used on genereated previews. If you change this after some files were generated, you must delete them manually.'),
    ),
  );

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