You are here

function _filebrowser_form_file_handlers_part in Filebrowser 6.2

2 calls to _filebrowser_form_file_handlers_part()
filebrowser_admin_settings in ./filebrowser.admin.inc
filebrowser_form in ./filebrowser.module
Implementation of hook_form().

File

includes/node.inc, line 331

Code

function _filebrowser_form_file_handlers_part($settings = NULL, $weight = 0) {
  $form = array();
  $handlers = module_implements("filebrowser_handler_info");
  if (count($handlers)) {
    if (is_null($settings)) {
      $globale_settings = variable_get('filebrowser', NULL);
      if (!is_null($globale_settings) && isset($globale_settings['file_handlers'])) {
        $settings = (object) $globale_settings['file_handlers'];
      }
      foreach ($handlers as $module) {
        if (!isset($settings->{$module})) {
          $defaults = array(
            'enabled_thumbnailer' => FALSE,
            'enabled_metadata' => FALSE,
          );
          $defaults += module_invoke($module, "filebrowser_handler_defaults");
          $settings->{$module} = (object) $defaults;
        }
        else {
          $settings->{$module} = (object) $settings->{$module};
        }
      }
    }
    $form['file_handlers'] = array(
      '#type' => 'fieldset',
      '#tree' => TRUE,
      '#title' => 'File handlers',
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
      '#weight' => $weight,
    );
    foreach ($handlers as $module) {
      $info = module_invoke($module, "filebrowser_handler_info");
      $form['file_handlers']["{$module}"] = array(
        '#type' => 'fieldset',
        '#tree' => TRUE,
        '#title' => $info['description'],
        '#collapsible' => TRUE,
        '#collapsed' => TRUE,
        '#weight' => -6,
      );
      $form['file_handlers']["{$module}"]['enabled_thumbnailer'] = array(
        '#type' => 'checkbox',
        '#title' => t('Enabled as thumbnailer'),
        '#description' => t('Enable this file handler as thumbnailer.'),
        '#default_value' => $settings->{$module}->enabled_thumbnailer,
      );
      $form['file_handlers']["{$module}"]['enabled_metadata'] = array(
        '#type' => 'checkbox',
        '#title' => t('Enabled as metadata provider'),
        '#description' => t('Enable this file handler as metadata provider.'),
        '#default_value' => $settings->{$module}->enabled_metadata,
      );
      $form['file_handlers']["{$module}"] += module_invoke($module, "filebrowser_handler_settings", $settings->{$module});
    }
  }
  return $form;
}