You are here

function feeds_ui_overview_form in Feeds 6

Same name and namespace in other branches
  1. 8.2 feeds_ui/feeds_ui.admin.inc \feeds_ui_overview_form()
  2. 7.2 feeds_ui/feeds_ui.admin.inc \feeds_ui_overview_form()
  3. 7 feeds_ui/feeds_ui.admin.inc \feeds_ui_overview_form()

Build overview of available configurations.

1 string reference to 'feeds_ui_overview_form'
feeds_ui_menu in feeds_ui/feeds_ui.module
Implementation of hook_menu().

File

feeds_ui/feeds_ui.admin.inc, line 51
Contains all page callbacks, forms and theming functions for Feeds administrative pages.

Code

function feeds_ui_overview_form(&$form_status) {
  $form = $form['enabled'] = $form['disabled'] = array();
  $form['#header'] = array(
    t('Name'),
    t('Description'),
    t('Attached to'),
    t('Status'),
    t('Operations'),
    t('Enabled'),
  );
  foreach (feeds_importer_load_all(TRUE) as $importer) {
    $importer_form = array();
    $importer_form['name']['#value'] = check_plain($importer->config['name']);
    $importer_form['description']['#value'] = check_plain($importer->config['description']);
    if (empty($importer->config['content_type'])) {
      $importer_form['attached']['#value'] = '[none]';
    }
    else {
      if (!$importer->disabled) {
        $importer_form['attached']['#value'] = l(node_get_types('name', $importer->config['content_type']), 'node/add/' . str_replace('_', '-', $importer->config['content_type']));
      }
      else {
        $importer_form['attached']['#value'] = check_plain(node_get_types('name', $importer->config['content_type']));
      }
    }
    if ($importer->export_type == EXPORT_IN_CODE) {
      $status = t('Default');
      $edit = t('Override');
      $delete = '';
    }
    elseif ($importer->export_type == EXPORT_IN_DATABASE) {
      $status = t('Normal');
      $edit = t('Edit');
      $delete = t('Delete');
    }
    elseif ($importer->export_type == (EXPORT_IN_CODE | EXPORT_IN_DATABASE)) {
      $status = t('Overridden');
      $edit = t('Edit');
      $delete = t('Revert');
    }
    $importer_form['status'] = array(
      '#value' => check_plain($status),
    );
    if (!$importer->disabled) {
      $importer_form['operations'] = array(
        '#value' => l($edit, 'admin/build/feeds/edit/' . $importer->id) . ' | ' . l(t('Export'), 'admin/build/feeds/export/' . $importer->id) . ' | ' . l(t('Clone'), 'admin/build/feeds/clone/' . $importer->id) . (empty($delete) ? '' : ' | ' . l($delete, 'admin/build/feeds/delete/' . $importer->id)),
      );
    }
    else {
      $importer_form['operations']['#value'] = ' ';
    }
    $importer_form[$importer->id] = array(
      '#type' => 'checkbox',
      '#default_value' => !$importer->disabled,
      '#attributes' => array(
        'class' => 'feeds-ui-trigger-submit',
      ),
    );
    if ($importer->disabled) {
      $form['disabled'][$importer->id] = $importer_form;
    }
    else {
      $form['enabled'][$importer->id] = $importer_form;
    }
  }
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
    '#attributes' => array(
      'class' => 'feeds-ui-hidden-submit',
    ),
  );
  return $form;
}