You are here

function theme_views_editablefields_view_list in Editable Fields 5.2

Same name and namespace in other branches
  1. 5.3 editablefields.module \theme_views_editablefields_view_list()
  2. 5 editablefields.module \theme_views_editablefields_view_list()

Display the nodes of a view as a list.

File

./editablefields.module, line 261

Code

function theme_views_editablefields_view_list($view, $nodes, $type) {
  $fields = _views_get_fields();
  $editable = _handle_editablefield_form_input($view, $nodes);
  foreach ($nodes as $node) {
    $item = '';
    foreach ($view->field as $field) {
      if (!isset($fields[$field['id']]['visible']) && $fields[$field['id']]['visible'] !== FALSE) {
        if ($field['label']) {
          $item .= "<div class='view-label " . views_css_safe('view-label-' . $field['queryname']) . "'>" . $field['label'] . "</div>";
        }
        $item .= "<div class='view-field " . views_css_safe('view-data-' . $field['queryname']) . "'>" . views_theme_field('views_editablefields_handle_field', $field['queryname'], $fields, $field, $node, $view) . "</div>";
      }
    }
    $items[] = "<div class='view-item " . views_css_safe('view-item-' . $view->name) . "'>{$item}</div>\n";

    // l($node->title, "node/$node->nid");
  }
  $html = theme('item_list', $items);
  if ($editable) {
    $newentry_form = _editablefields_entry_form($view);
    if ($nodes) {
      $form['editablefields']['submit'] = array(
        '#type' => 'submit',
        '#value' => t('Submit'),
      );
      $form['editablefields']['#value'] = $html;
      drupal_process_form('editablefields', $form);
      $eform = drupal_render($form);
      return $eform . $newentry_form;
    }
    else {
      return $newentry_form;
    }
  }
  else {
    return $html;
  }
}