You are here

function LinkitSearchPluginFile::buildSettingsForm in Linkit 7.3

Overrides LinkitSearchPluginEntity::buildSettingsForm().

Overrides LinkitSearchPluginEntity::buildSettingsForm

File

plugins/linkit_search/file.class.php, line 158
Define Linkit file search plugin class.

Class

LinkitSearchPluginFile
Reprecents a Linkit file search plugin.

Code

function buildSettingsForm() {
  $form = parent::buildSettingsForm();
  $form['entity:file']['show_scheme'] = array(
    '#title' => t('Show file scheme'),
    '#type' => 'checkbox',
    '#default_value' => isset($this->conf['show_scheme']) ? $this->conf['show_scheme'] : '',
  );
  $form['entity:file']['group_by_scheme'] = array(
    '#title' => t('Group files by scheme'),
    '#type' => 'checkbox',
    '#default_value' => isset($this->conf['group_by_scheme']) ? $this->conf['group_by_scheme'] : '',
  );
  $form['entity:file']['url_type'] = array(
    '#title' => t('URL type'),
    '#type' => 'radios',
    '#options' => array(
      LINKIT_FILE_URL_TYPE_DIRECT => t('Direct file link'),
      LINKIT_FILE_URL_TYPE_DOWNLOAD => t('Download file link'),
      LINKIT_FILE_URL_TYPE_ENTITY => t('Entity view page'),
    ),
    '#default_value' => isset($this->conf['url_type']) ? $this->conf['url_type'] : $this
      ->getDefaultUrlType(),
  );

  // We can only support the download type if we have version 2.x of the file_entity module.
  if (!(module_exists('file_entity') && function_exists('file_entity_download_uri'))) {
    unset($form['entity:file']['url_type']['#options'][LINKIT_FILE_URL_TYPE_DOWNLOAD]);
  }
  $image_extra_info_options = array(
    'thumbnail' => t('Show thumbnails <em>(using the image style !linkit_thumb_link)</em>', array(
      '!linkit_thumb_link' => l(t('linkit_thumb'), 'admin/config/media/image-styles/edit/linkit_thumb'),
    )),
    'dimensions' => t('Show pixel dimensions'),
  );
  $form['entity:file']['image_extra_info'] = array(
    '#title' => t('Images'),
    '#type' => 'checkboxes',
    '#options' => $image_extra_info_options,
    '#default_value' => isset($this->conf['image_extra_info']) ? $this->conf['image_extra_info'] : array(
      'thumbnail',
      'dimensions',
    ),
  );
  return $form;
}