You are here

function scald_dailymotion_imports_form in Scald: Media Management made easy 6

Defines the import settings form.

1 string reference to 'scald_dailymotion_imports_form'
scald_dailymotion_menu in scald_dailymotion/scald_dailymotion.module
Implements hook_menu.

File

scald_dailymotion/scald_dailymotion.admin.inc, line 10
Provides admin form for DailyMotion's Scald Provider.

Code

function scald_dailymotion_imports_form() {
  $form = array();
  $imports = variable_get('scald_dailymotion_imports', array());
  $types = array(
    'user' => t('User'),
    'tag' => t('Tag'),
  );
  if (count($imports)) {
    $form['imports'] = array(
      '#type' => 'fieldset',
      '#title' => t('Current imports'),
      '#tree' => TRUE,
      '#theme' => 'scald_dailymotion_imports_table',
    );
    foreach ($imports as $key => $import) {
      $form['imports'][$key] = array(
        'type' => array(
          '#type' => 'select',
          '#title' => t('Type'),
          '#options' => array(
            'delete' => t('<Delete>'),
          ) + $types,
          '#default_value' => $import['type'],
        ),
        'value' => array(
          '#type' => 'textfield',
          '#title' => t('Identifier'),
          '#default_value' => $import['value'],
        ),
      );
    }
  }
  $form['add'] = array(
    '#type' => 'fieldset',
    '#title' => t('Add import'),
    '#collapsible' => TRUE,
    '#collapsed' => count($imports),
  );
  $form['add']['type'] = array(
    '#type' => 'select',
    '#title' => t('Type'),
    '#options' => $types,
  );
  $form['add']['value'] = array(
    '#type' => 'textfield',
    '#title' => t('Identifier'),
    '#description' => t('This field value meaning depends on the Type
    field defined above. For a <em>User</em> import, put the username
    whose videos you\'d loke to import here, for a tag import, use the
    tag name.'),
  );
  $form['add']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Add this import'),
    '#submit' => array(
      'scald_dailymotion_imports_form_add',
    ),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save configuration'),
  );
  return $form;
}