You are here

function theme_feed_import_edit_filter_form in Feed Import 7.3

Same name and namespace in other branches
  1. 7 feed_import.module \theme_feed_import_edit_filter_form()
  2. 7.2 feed_import.module \theme_feed_import_edit_filter_form()

Theme form feed_import_edit_filter_form

File

./feed_import.module, line 1902
User interface, cron functions for feed_import module

Code

function theme_feed_import_edit_filter_form($form) {
  $form = $form['form'];
  $header = array(
    t('Filter name'),
    t('Filter function'),
    t('Function params (one per line)'),
    t('Select'),
    t('Weight'),
  );
  foreach ($form['#filter_fields'] as &$field) {
    $rows = array();
    if (!empty($form['container_' . $field]['table_content'][$field])) {
      foreach ($form['container_' . $field]['table_content'][$field] as $id => &$row) {
        if (!is_numeric($id)) {
          continue;
        }

        // Table columns.
        $data = array(
          'name',
          'function',
          'params',
          'selected',
          'weight',
        );
        foreach ($data as &$d) {
          if (isset($row[$d]['#checked'])) {
            $row[$d]['#checked'] = FALSE;
          }
          $row[$d]['#value'] = $row[$d]['#default_value'];
          $d = drupal_render($row[$d]);
        }
        $rows[] = array(
          'data' => $data,
          'class' => array(
            'draggable',
          ),
        );
      }
    }
    drupal_add_tabledrag('table_' . $field, 'order', 'sibling', 'weight');
    $form['container_' . $field]['table_content'][$field] = array(
      '#theme' => 'table',
      '#header' => $header,
      '#rows' => $rows,
      '#attributes' => array(
        'id' => 'table_' . $field,
      ),
      '#empty' => t('There are no filters.'),
    );
  }
  return drupal_render_children($form);
}