You are here

function emfield_module_settings in Embedded Media Field 6.2

Same name and namespace in other branches
  1. 6.3 emfield.admin.inc \emfield_module_settings()
  2. 6.3 deprecated/emfield-deprecated.admin.inc \emfield_module_settings()
1 string reference to 'emfield_module_settings'
emfield_menu in ./emfield.module
Implementation of hook_menu().

File

./emfield.admin.inc, line 115
The administrative settings page.

Code

function emfield_module_settings(&$form_state, $module) {
  $form = array();
  $header = array(
    t('Feature'),
    t('Supported'),
    t('Notes'),
  );
  $emfield_info = module_invoke($module, 'emfield_info');
  $providers = emfield_system_list($module);
  $form = array(
    '#type' => 'fieldset',
    '#title' => t('@module', array(
      '@module' => $emfield_info['#name'],
    )),
    '#description' => $emfield_info['#settings_description'],
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form = array_merge($form, module_invoke($module, 'emfield_settings'));
  $form['providers'] = array(
    '#type' => 'fieldset',
    '#title' => t('Providers'),
    '#description' => t('The following settings determine what providers are allowed, and what provider-specific options, if any, are set.'),
  );

  // Add vertical tabs display if available.
  $form['providers']['#pre_render'][] = 'vertical_tabs_form_pre_render';
  foreach ($providers as $provider) {
    $info = emfield_include_invoke($module, $provider->name, 'info');
    $form['providers'][$provider->name] = array(
      '#type' => 'fieldset',
      '#title' => t('@provider configuration', array(
        '@provider' => $info['name'],
      )),
      '#description' => $info['settings_description'],
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
    );
    if (is_array($info['supported_features']) && !empty($info['supported_features'])) {
      $form['providers'][$provider->name]['supported_features'] = array(
        '#type' => 'fieldset',
        '#title' => t('Supported features'),
        '#description' => t('This is a list of the current state of support for the following features by %provider:', array(
          '%provider' => $info['name'],
        )),
        '#collapsible' => TRUE,
        '#collapsed' => TRUE,
        '#weight' => 7,
      );
      $form['providers'][$provider->name]['supported_features']['features'] = array(
        '#type' => 'markup',
        '#value' => theme('table', $header, $info['supported_features']),
      );
    }
    $form['providers'][$provider->name]['emfield_' . $module . '_allow_' . $provider->name] = array(
      '#type' => 'checkbox',
      '#title' => t('Allow content from %provider', array(
        '%provider' => $info['name'],
      )),
      '#description' => t('If checked, then content types may be created that allow content to be provided by %provider.', array(
        '%provider' => $info['name'],
      )),
      '#weight' => -10,
      '#default_value' => variable_get('emfield_' . $module . '_allow_' . $provider->name, TRUE),
    );
    $form['providers'][$provider->name][] = emfield_include_invoke($module, $provider->name, 'settings');
  }
  $form = system_settings_form($form);
  return $form;
}