So I have this filter in page view
Content translation: Language (= Current user's language)
and in Footer
Entity: Rendered entity ( node:354)
node:354 is on English, but It is also displayed on other languages.
There is no way to display some node only on one language?
Guessing then it is also not possible to have language appropriate node in Views Footer?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

couturier’s picture

Is this person having your same problem? http://drupal.org/node/1744950

Marko B’s picture

Nope, this is just a missing feature of Views how I described it, that could also be taken as bug.

dawehner’s picture

Project: Views (for Drupal 7) » Entity API
Version: 7.x-3.4 » 7.x-1.x-dev
Component: node data » Views integration
Category: bug » feature

Well this entity is rendered by entity api, so views is somehow the wrong project.

As deepM said this is a feature request.

marcvangend’s picture

Title: Footer rendered entetiy doesn't respect Language » Entity Views area handler does not support translations
Status: Active » Needs review
FileSize
2.63 KB

Here is a patch to support translations for nodes. It adds a checkbox to the options form, so the user can choose to whether he wants to use the translation. When the entity is rendered, it will check if the option was enabled and if a translation is available. If so, the translation is loaded.

Thanks for reviewing and (hopefully) committing my patch.

lmeurs’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community

Thanks marcvangend, the patch from #4 works great, though is based on an earlier version of the Entity API.

Main difference is in the render_entity() function where the newer version of the Entity API loads a single entity object using entity_load_single() instead of an array of entity objects using entity_load().

I manually applied this patch and am sorry I do not know how to generate a new diff file.

marcvangend’s picture

Thanks for the review, Laurens. Two minor updates have been released since I posted that patch, but it's good to hear the concept still works.

If you have git running on your development machine, this page contains all info you need to create a patch: https://drupal.org/project/entity/git-instructions.

lmeurs’s picture

Thank you for the info, will give it a try soon!

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 4: 1744362-4-entity-views-area-translation.patch, failed testing.

pobster’s picture

Updated for the single entity loading approach.

Thanks,

Pobster

pobster’s picture

...And if it's any use to anyone else, I've extended it further so that if there's no translation available then you can avoid the rendering completely. Note... This is inside the tnid if statement - so if shouldn't have any effect on non-translated nodes.

Thanks,

Pobster

pobster’s picture

Status: Needs work » Needs review
pobster’s picture

I figured if you were going to have an "obey language" button then it should work for source nodes which don't have translations too...

I think this is the last one, it doesn't make any sense tweaking this further.

Pobster

Chris Matthews’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll

The 5 year old patch in #12 to entity_views_handler_area_entity.inc does not apply to the latest entity 7.x-1.x-dev and (if relevant) needs a reroll.

Checking patch views/handlers/entity_views_handler_area_entity.inc...
error: while searching for:
  /**
   * Render an entity using the view mode.
   */
  public function render_entity($entity_type, $entity_id, $view_mode) {
    if (!empty($entity_type) && !empty($entity_id) && !empty($view_mode)) {
      $entity = entity_load_single($entity_type, $entity_id);
      if (!empty($this->options['bypass_access']) || entity_access('view', $entity_type, $entity)) {
        $render = entity_view($entity_type, array($entity), $view_mode);
        $render_entity = reset($render);

error: patch failed: views/handlers/entity_views_handler_area_entity.inc:104
error: views/handlers/entity_views_handler_area_entity.inc: patch does not apply
pobster’s picture

I think ... if it's been five years, then it probably isn't useful to anyone? Maybe this issue should be closed?

Chris Matthews’s picture

Status: Needs work » Closed (won't fix)
calbasi’s picture

Status: Closed (won't fix) » Active
Related issues: +#2289397: Multilingual Entity: Rendered entity

This issue is still active and it's a real problem. Why it has not been commited when possible?

Possibly related with: 2289397