You are here

function plupload_admin_settings in Plupload integration 6

Admin form.

1 string reference to 'plupload_admin_settings'
plupload_menu in ./plupload.module
Implementation of hook_menu().

File

./plupload.module, line 50

Code

function plupload_admin_settings() {

  // Figure out which content types have a filefield.
  $types = content_types();
  foreach ($types as $key => $type) {
    foreach ($type['fields'] as $field) {
      if ($field['type'] == 'filefield') {
        $available['matches'][$key . ':::' . $field['field_name']] = $type['name'] . ': ' . $field['widget']['label'];
        $available['keys'][] = $key . ':::' . $field['field_name'];
      }
    }
  }

  // Show them a filefield-content-type to use or nag them to create one.
  if (!empty($available['matches'])) {
    $form['plupload_import_field_type'] = array(
      '#type' => 'select',
      '#title' => t('Target field'),
      '#description' => t('Select the specific filefield you want to import photos into. During import, nodes of your selected type will be created and the selected field will be populated with the imported image. The image name will be used for the title and all other fields will be blank.'),
      '#options' => $available['matches'],
      '#default_value' => variable_get('plupload_import_field_type', $available['keys'][0]),
    );
  }
  else {
    $form['error_state'] = array(
      '#value' => t('You must enable a filefield on a content type.'),
    );
  }
  return system_settings_form($form);
}