When I create a views and I add the "translate link" field I see this error message:
"SQLSTATE[42S22]: Column not found: 1054 Unknown column 'node_revision.format' in 'field list'"
and views doesn't show nothing else.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

manu manu’s picture

Project: Internationalization » Views (for Drupal 7)
Version: 7.x-1.0-beta7 » 7.x-3.x-dev
Component: Miscellaneous » Translations

This is a Views's Translation submodule problem.

Commenting lines 11 and 20 in views/modules/translation/views_handler_field_node_link_translate.inc :

<?php
/**
 * Field handler to present a link node translate.
 */
class views_handler_field_node_link_translate extends views_handler_field_node_link {
  function construct() {
    parent::construct();
    $this->additional_fields['uid'] = 'uid';
    $this->additional_fields['type'] = 'type';
    $this->additional_fields['language'] = 'language';
    //$this->additional_fields['format'] = array('table' => 'node_revision', 'field' => 'format');
  }

  function render_link($data, $values) {
    // ensure user has access to edit this node.
    $node = new stdClass();
    $node->nid = $this->get_value($values, 'nid');
    $node->uid = $this->get_value($values, 'uid');
    $node->type = $this->get_value($values, 'type');
    //$node->format = $this->get_value($values, 'format');
    $node->language = $this->get_value($values, 'language');
    $node->status = 1; // unpublished nodes ignore access control
    if (empty($node->language) || !translation_supported_type($node->type) || !node_access('view', $node) || !user_access('translate content')) {
      return;
    }

    $this->options['alter']['make_link'] = TRUE;
    $this->options['alter']['path'] = "node/$node->nid/translate";
    $this->options['alter']['query'] = drupal_get_destination();

    $text = !empty($this->options['text']) ? $this->options['text'] : t('translate');
    return $text;
  }
}


I do not provide a patch since I don't know the impact on views internals, but this will remove the error and the view seems to work again...

ConradFlashback’s picture

thanks manu manu for the tip, I will post in views support forum.

manu manu’s picture

Status: Active » Needs review
FileSize
1.27 KB

you're welcome ConradFlashback, I moved this issue to the views issue queue.

Finally attaching a patch to help gaining attention for this issue.

dawehner’s picture

Status: Needs review » Fixed

Okay commited this short term fix and link to this issue #1139754: Use the real entity status instead of dummy to check access in edit link which will talk it for real.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.