You are here

function feeds_ui_overview_form in Feeds 7

Same name and namespace in other branches
  1. 8.2 feeds_ui/feeds_ui.admin.inc \feeds_ui_overview_form()
  2. 6 feeds_ui/feeds_ui.admin.inc \feeds_ui_overview_form()
  3. 7.2 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
Implements 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, &$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']['#markup'] = check_plain($importer->config['name']);
    $importer_form['description']['#markup'] = check_plain($importer->config['description']);
    if (empty($importer->config['content_type'])) {
      $importer_form['attached']['#markup'] = '[none]';
    }
    else {
      if (!$importer->disabled) {
        $importer_form['attached']['#markup'] = l(node_type_get_name($importer->config['content_type']), 'node/add/' . str_replace('_', '-', $importer->config['content_type']));
      }
      else {
        $importer_form['attached']['#markup'] = node_type_get_name($importer->config['content_type']);
      }
    }
    if ($importer->export_type == EXPORT_IN_CODE) {
      $status = t('Default');
      $edit = t('Override');
      $delete = '';
    }
    else {
      if ($importer->export_type == EXPORT_IN_DATABASE) {
        $status = t('Normal');
        $edit = t('Edit');
        $delete = t('Delete');
      }
      else {
        if ($importer->export_type == (EXPORT_IN_CODE | EXPORT_IN_DATABASE)) {
          $status = t('Overridden');
          $edit = t('Edit');
          $delete = t('Revert');
        }
      }
    }
    $importer_form['status'] = array(
      '#markup' => $status,
    );
    if (!$importer->disabled) {
      $importer_form['operations'] = array(
        '#markup' => l($edit, 'admin/structure/feeds/edit/' . $importer->id) . ' | ' . l(t('Export'), 'admin/structure/feeds/export/' . $importer->id) . ' | ' . l(t('Clone'), 'admin/structure/feeds/clone/' . $importer->id) . (empty($delete) ? '' : ' | ' . l($delete, 'admin/structure/feeds/delete/' . $importer->id)),
      );
    }
    else {
      $importer_form['operations']['#markup'] = ' ';
    }
    $importer_form[$importer->id] = array(
      '#type' => 'checkbox',
      '#default_value' => !$importer->disabled,
      '#attributes' => array(
        'class' => array(
          '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' => array(
        'feeds-ui-hidden-submit',
      ),
    ),
  );
  return $form;
}