You are here

function icon_provider_import_form in Icon API 8

Same name and namespace in other branches
  1. 7 includes/import.inc \icon_provider_import_form()

Menu callback for 'icon_provider_import_form'.

File

includes/import.inc, line 11
import.inc Provides import administrative callbacks and tasks.

Code

function icon_provider_import_form($form, $form_state) {

  // Build a list of providers.
  $providers = array(
    'automatic' => t('Automatically detect'),
  );
  foreach (icon_providers_support_import() as $provider) {
    $providers[$provider['name']] = $provider['title'];
  }
  $form['title'] = array(
    '#type' => 'textfield',
    '#title' => t('Bundle title'),
    '#description' => t('The human readable name to identify the bundle.'),
    '#required' => TRUE,
  );
  $form['name'] = array(
    '#type' => 'machine_name',
    '#title' => t('Bundle name'),
    '#description' => t('A unique name to identify the bundle. It must only contain lowercase letters, numbers, hyphens and underscores.'),
    '#required' => TRUE,
    '#machine_name' => array(
      'exists' => 'icon_bundle_load',
      'source' => array(
        'title',
      ),
    ),
  );
  $form['provider'] = array(
    '#type' => 'select',
    '#title' => t('Provider'),
    '#options' => $providers,
    '#default_value' => 'automatic',
    '#required' => TRUE,
  );
  $form['file'] = array(
    '#type' => 'file',
    '#title' => t('Archive file'),
    '#description' => t('Files with the following extensions are allowed: %extensions', array(
      '%extensions' => archiver_get_extensions(),
    )),
    '#size' => 40,
  );
  $form['bundle']['import'] = array(
    '#type' => 'submit',
    '#value' => t('Import'),
  );
  return $form;
}