0

I have created a Panels Everywhere variant that uses a single View with a contextual filter (Content Type). The Panel variant is set to page paths. These paths are related to content types. For example:

Path:

drivers (list of 'driver' Content Type)
lawyers (list of 'lawyer' Content Type)

So if I go to /drivers the Context of Content Type 'driver' should be passed to the View, etc. I know this is possible as %user context is a variable object; therefore, I should be able to create another variable object and pass this to the View. The problem is that I don't know where to start :( Any ideas?

1

Large parts of the question doesn't actually make sense to me, but...

If you want to pass an arbitrary part of the URL as a string to a View, just assign that variable part to a string in the argument settings, and then set that argument, %url_from_string, as the argument to the View.

The better solution though, would be to create a new context type called 'content type', because I don't think a context like that is available out of the box, and then assign the argument to that instead. That allows you to do validation of the incoming context and gracefully handle an argument that's not valid.

A third solution, though mostly a workaround, is to tell the View to pull it's arguments directly from the URL. This setting is available for all content pane displays under their argument settings.

  • The difficulty here is that I don't want to pass the content type as an argument because it's redundant: The path already explains what content I am trying to access. If I go to '/drivers' it would make no sense to have a query of '/drivers/driver' or '/drivers?type=driver'. Is there to a way to pass the only path element of the page URL without the arguments as context? – Ken J Jun 21 '13 at 15:47
  • If your pages are at the root, /, then you can't have variable arguments, but you can still manually attach the relevant context to each page. Also having the View pulling it's argument from the URL will also still work, though I still wouldn't recommend it. – Letharion Jun 23 '13 at 17:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.