I have a view with an argument of Node: Content Type. I have a panels page for the node_view page which is loading the view. I'm trying to pass the content type of the node being viewed to the view, but I have a feeling it is passing the human readable name instead of the machine name. The use case is that I'm trying to display a list of nodes of the same type as is currently being viewed. Does it sound like I'm doing something wrong? Otherwise please tell me where to start debugging this. I've attached the export of the view.

Files: 
CommentFileSizeAuthor
#10 1229478-Unable-to-pass-content-type-machine-name-fro.patch3.88 KBmstrelan
PASSED: [[SimpleTest]]: [MySQL] 67 pass(es).
[ View ]
#9 1229478-view-context-raw-tokens.patch3.3 KBmerlinofchaos
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 1229478-view-context-raw-tokens_0.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
#8 1229478-view-context-raw-tokens.patch2.5 KBmerlinofchaos
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 1229478-view-context-raw-tokens.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
#3 1229478 page variant.txt6.22 KBmstrelan
views content type argument.txt17.45 KBmstrelan

Comments

You only have a block display, which makes it much more difficult to actually pass data. How are you trying to pass this content type to the view?

Status:Active» Postponed (maintainer needs more info)

StatusFileSize
new6.22 KB

My page variant of node/%/view is attached. The content type argument is passed in the bottom pane.

  $pane->configuration = array(
    'context' => array(
      0 => 'relationship_entity_from_field:field_precinct-node-taxonomy_term_1.tid',
      1 => 'argument_entity_id:node_1.content-type',
      2 => 'argument_entity_id:node_1.nid',
    ),
  );

Note that my view now also has a third argument to exclude the current node.

Hm. For entities we're using core tokens, which is how things get converted. Dave Reid tells me that token.module provides a machine name -- are you using token.module? You may need to for this.

are you using token.module

I do have the module enabled, not sure if I'm using it in this instance.

The reason I thought it may be using a human readable name is that I added "new custom content" to my page and entered something like %node:content-type and it printed "Dining outlet" instead of "dining_outlet".

The actual token for the machine name is %node:content-type:machine-name I believe.

Status:Postponed (maintainer needs more info)» Active

Thanks but that didn't work. I went in to page manager, edit the content of my variant, edit the settings of my view pane. There I changed the select list for the Content Type argument to "No Context" and in the Arguments text field I entered %node:content-type:machine-name. The view did not display. Still so far the only way that works is to enter the actual machine name in to the aforementioned text field. The only success I did have was that adding a custom content pane with %node:content-type:machine-name displayed the actual machine name instead of the human readable name.

PS. In these situations where I have provided more info do you want the status set back to "active" or should I leave this for you to change?

StatusFileSize
new2.5 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 1229478-view-context-raw-tokens.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

PS. In these situations where I have provided more info do you want the status set back to "active" or should I leave this for you to change?

Definitely back to active.

I think I may finally understand what is wrong here. This patch should allow you to make this work.

This patch relies on a commit I *just* pushed, so you will have to apply this to a very recent -dev.

StatusFileSize
new3.3 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 1229478-view-context-raw-tokens_0.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

Whoops. I hadn't saved a file. This patch is better.

Status:Active» Reviewed & tested by the community
StatusFileSize
new3.88 KB
PASSED: [[SimpleTest]]: [MySQL] 67 pass(es).
[ View ]

There is a bracket missing at the end of the addition to views_content_views_content_type_render(). Updated patch attached.

I have tested this with a views page display displayed in a panel with the content type argument passed from the node panel context. This worked perfectly. I have not tested with pane display and not quite sure what the view_from_argument hunk is for, but I imagine they should work also.

This bug bit me, too. When will it be included in a stable release?

This just bit me as well...and I was unable to get the patch above to resolve the issue.

I'm putting %node:content-type:machine-name into the argument, and it's not recognized by views at all. I'm printing out the argument in the "No Results Behavior", and I get "Club News:machine-name == Content: Type input". Thus it looks like it's being a bit too greedy in it's evaluation of the token string.

Status:Reviewed & tested by the community» Fixed

#12 would be an unrelated bug to this. The patch itself is one I actually thought I had already committed and did not. I feel bad about that.

In any case, committed and pushed!

Status:Fixed» Closed (fixed)

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