I use the view "Taxonomy term" that emulates the Drupal core's handling of taxonomy/term.
I want to display a term image and a term description for each term of "Brand" vocabulary.
Using "Rendered entity" in Views Header I can specify only an exact Entity ID.

It would be nice if you could put %1 or %2 into Entity ID to get the name or ID from URL (or rather - from contextual filters).
For now I can only use static Entity IDs and get only a single entity in header: http://puu.sh/2r1V1

views header - rendered entity

Files: 
CommentFileSizeAuthor
#13 entity_id_token-1957266-12.patch2.48 KBDeciphered
PASSED: [[SimpleTest]]: [MySQL] 414 pass(es).
[ View ]
#12 rendered-entity-Capture.JPG70.14 KBarx-e
#10 entity_views_handler_area_entity.inc_.patched.gz1.6 KBarx-e
#6 views_area_handler_arguments-1957266-3-for1-2-fails-at-106.patch2.51 KBarx-e
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch views_area_handler_arguments-1957266-3-for1-2-fails-at-106.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
#3 views_area_handler_arguments-1957266-3.patch2.41 KBstBorchert
PASSED: [[SimpleTest]]: [MySQL] 374 pass(es).
[ View ]
views.header.rendered.entity.png25.25 KBAce Cooper

Comments

Project:Views» Entity API
Issue summary:View changes

spelling

Issue summary:View changes

image size changed

Issue summary:View changes

markup changes

Issue summary:View changes

a little more

Issue summary:View changes

results

Version:7.x-3.x-dev» 7.x-1.x-dev
Component:Code» Views integration

I looked into the code and found out, that the Rendered Entity option comes from Entity API module.
Moving the topic over there. Found no similar issue yet, will try to come up with a patch myself.

UPD. Made a dirty hack for only my use-case. But it's a start...
In /sites/all/modules/entity/views/handlers/entity_views_handler_area_entity.inc replaced:

return $this->render_entity($this->options['entity_type'], $this->options['entity_id'], $this->options['view_mode']);

with the following code:

$brand_arg = arg(2);
return $this->render_entity($this->options['entity_type'], $brand_arg, $this->options['view_mode']);

It works for me, but a more permanent solutions with %1, %2, etc would be much more useful for everybody.

Very odd that this got overlooked, it seems the most likey thing one would want to do.

Here is a more complete fix. You will then be able to use %0, %1 ... to reference a path argument.

<?php
public function render($empty = FALSE) {
  if (!
$empty || !empty($this->options['empty'])) {
    if (
$this->options['entity_id'][0] == '%') {
     
$this->options['entity_id'] = arg((integer)substr($this->options['entity_id'], 1));
    }
    return
$this->render_entity($this->options['entity_type'], $this->options['entity_id'], $this->options['view_mode']);
  }
  return
'';
}
?>

No it needs to be rolled into a patch.

Status:Active» Needs review
StatusFileSize
new2.41 KB
PASSED: [[SimpleTest]]: [MySQL] 374 pass(es).
[ View ]

Attached patch uses the default "render tokens" method of views core to substitute argument tokens in field "Entity id".

The patch from #3 applied cleanly, works like a charm and the code looks simple and efficient to me. I'd say a perfect fix, but since I don't have much experience reviewing Drupal code I'm reluctant to mark it RBTC.

Does this patch only allow use of URL arguments? I have contextual filters but no argument and I cannot get it to pull the filter using !1 or %1. I have a contextual filter which gets the UID of the currently logged in user. This patch doesn't help with that.
Edit: The above does seem to work in a normal display but isn't working when generating a views_pdf display. That's a fault of views_pdf module because it doesn't pass the arguments correctly.

It would be great if it worked like 'replacement patterns' when you add a header textarea so you can 'Use replacement tokens from the first row' which includes field tokens and filters.

StatusFileSize
new2.51 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch views_area_handler_arguments-1957266-3-for1-2-fails-at-106.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

I came here while searching how I could possibly achieve this functionality.

But from what I see this has not been committed.
I tried to apply the patch in #3 to the latest version 7.x-1.2 but it failed.
After trying and failing to adapt the patch to 7.x-1.2 (I have never done it again), I entered the changes manually and I can confirm it works - at least in one instance and with contextual filters.

I have not tested with tokens but seems to me as significant functionality.

The attached file is my failed attempt at amending the patch.
The error message I kept getting is "Hunk #2 FAILED at 106."

Status:Needs review» Needs work

The last submitted patch, views_area_handler_arguments-1957266-3-for1-2-fails-at-106.patch, failed testing.

Issue summary:View changes

making things even more clear

Just tried applying the code from #3, no longer seems to work. Would be awfully helpful, any ideas?

Hi, I was able to make it work by manually copy/pasting the patch code in the new entity_views_handler_area_entity.inc file but my attempt at creating a patch was not successful.

I am attaching the file that works for me.
(as in this page http://www.kuwaitbirds.org/birds/conservation-status/near-threatened )

Issue summary:View changes
StatusFileSize
new1.6 KB

This is the 7.x-1.2 entity_views_handler_area_entity.inc file manually patched with #3.

Drupal 7.23
Entity API 7.x-1.2
Views 7.x-3.7

I have tried both solutions offered at:

#2 by RogerB

#3 (via #10 manual patch from arx-e)

I can't get any of them to work, as soon as I put any argument in (say %0, %1 for the #2 approach and/or [term:tid] token for #3 approach) I get the following error on previewing a term view:

An AJAX HTTP error occurred.
HTTP Result Code: 500
Debugging information follows.
Path: /admin/structure/views/view/taxonomy_term/preview/page/ajax
StatusText: Service unavailable (with message)
ResponseText: EntityMalformedException: Missing bundle property on entity of type taxonomy_term. in entity_extract_ids() (line 7693 of .../drupal7/includes/common.inc).

StatusFileSize
new70.14 KB

I am using !1 (as you can see in the attachment).

Status:Needs work» Needs review
StatusFileSize
new2.48 KB
PASSED: [[SimpleTest]]: [MySQL] 414 pass(es).
[ View ]

Re-rolled patch from #3 as it doesn't apply to current HEAD.

No interdiff for that exact reason.

I did make one change, which is I changed the token format from '!1' to '%1' because that is an existing standard in views and it makes little sense to change it. Happy to reconsider this if there is a valid reason it was used.

Patch by Deciphered at #13 worked fine against 7.x-1.x-dev 2013-Nov-15, thanks.

I am using %1 ok with a taxonomy term as rendered entity.

However, I can only see the header in the Views UI admin preview, I can't see the header in the view served to other users when using Taxonomy Views Integrator (TVI). It may of course be a separate problem, will investigate more ..

I tried switching themes just in case, header still only appears in Views admin UI preview.

Then tried setting Bypass access checks on, header still only appears in Views admin UI preview.

Maybe should fork as separate issue.

Just reapplied the patch over Entity 7.x-1.5 and it seems OK.
Any chance this getting committed?