Panel Pages and Taxonomy Term Arguments I am working on a new Drupal 7 site that is making heavy use of Panels to build pages.

I have a page where a view will be added to a content pane.  For various reasons, the view cannot be its own page.  This particular view has a Contextual Filter on it, Content: Has taxonomy term ID.  View works great with numeric arguments.

I would like my panel page to use the term name as the argument for the view instead of the term ID.  And, for various reason, I cannot use the taxonomy/term/%taxonomy_term override that comes with Panels.

If I set up the context option for the page (Settings / Arguments) to use Term Name, I can get the argument to work.  My problem is that the vocabulary I need to use has terms with lots of capitalization and spaces in it.  So, the URLs end up unreadable.

We have a custom ctools arguments plugin that can handle pathauto-style term names, where the term is lowercased and spaces are converted to dashes, but it was done for Drupal 6.  Before I spend the time to rework it for Drupal 7, I wanted to see if there is a better and/or existing solution.

In summary,


I have a panel page with path foo/!term
Panel page has a view with a taxonomy term ID argument, where the view argument should be based on the URL
I would like to have URLs like foo/apple-beet-carrot instead of foo/Apple%20Beet%20Carrot
I cannot use the system override for taxonomy/term/%taxonomy_term


What is the best way to go about this with Drupal 7, Views 3, ctools, and Panels, short of making a new ctools argument plugin?
There may be better routes out there, but I am going to suggest the one I have in mind right now. 

You could create your own custom block - that wraps around the Views block display that you already created. Why? Because that way you have full control of the arguments.

Wrapping a Views block display with your own custom block:


Implement hook_block_info() and hook_block_view().
Inside your hook_block_view() call the View display programatically. The View display should be a block (it looks like you got it already configured).
While instantiating the View display, you can grab the arguments from the URL using the arg() function. Since this is your own code, you can do anything that you want with those arguments. For example, you could load a term using an nid-based argument, get the term's proper name, URL-decode it if needed, and then feed it to your display.
Execute the View display, retrieve the results, and return them as the output of your block.


Then instead of embedding in the panel the block that was provided by your View, you embed the one that you created in your custom module. Again, since you called the View programatically, you had full control of the arguments that were passed to it.

It sounds complex, but it's really easier than you think. Here's a plain example of how to call the View (you could modify it for your needs):

$view = views_get_view('my_foobar_view');
$result = $view-&gt;execute_display('block_display_baz');
$term_id = arg(2); // Get the term from my-panel/foo/&lt;term id&gt;
$view-&gt;set_arguments(array($term_id));
$view-&gt;execute();
if(!empty($view-&gt;result)) {
  foreach($view-&gt;result as $result) {
    // Do something with $result...
  }
}


This G.D.O. document can provide you with more examples on how to programatically embed Views.