I am trying to use themekey to apply a theme just to the views master display. I have tried using view;human-name with no luck.

I want the theme to just apply to the view on the page and not effect the overall theme. Just want a specific theme for a view on a page.

Does anyone have any insight on this or anything I am missing?

I have tried:

VIEWS:HUMAN_NAME
Description
Views: Human Name - The (human readable) name of a view
Page Cache
Supported

VIEWS:MACHINE_NAME
Description
Views: Machine Name - The machine name of a view
Page Cache
Supported

CommentFileSizeAuthor
#11 themekey_views-2280669-11.patch771 bytesmarkabur
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mkalkbrenner’s picture

Just enable ThemeKey Debug to see the values of the properties you have to use.

mkalkbrenner’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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

attisan’s picture

Status: Closed (fixed) » Active

sry for reopening this issue - but the debug reports "empty" for all views:[] entries no matter what I do. could you point me into the right direction?

greets, attisan

mkalkbrenner’s picture

you have to go to the views' page where you can see the output of the view. At the bottom you'll find ThemeKey's debug information related to this page. views:human_name, views:machine_name and views:vid should not be empty.
1

attisan’s picture

well, they are :-( empty on edit pages and on any views generated page.

mkalkbrenner’s picture

can you post the complete debug output of such a page?

attisan’s picture

Category: Support request » Bug report

after playing around I found the bug - views pages using placeholders ("%" for the contextual filters) don't work. the debug output for views with static paths works like described. however, I think this should be considered a bug.

this bug holds true for the actual theme-key rules too.

greets, attisan

attisan’s picture

here is a quick and dirty fix (file /modules/themekey.views.inc)

function themekey_views_get_simple_property_by_getq($get_q, $property) {
  static $all_views = NULL;

  if (is_null($all_views)) {
    $all_views = views_get_all_views();
  }

  if (!empty($all_views)) {
    foreach ($all_views as $views_name => $view) {
      $view_path = $view->get_url();
      if ($view_path) {
        $regex_path = str_replace('*', '.*?', $view_path);
        $regex_path = str_replace('/', '\/', $regex_path);

        if (preg_match("/$regex_path/", $get_q)) {
          return $view->$property;
        }
      }
    }
  }

  return NULL;
}

beware the shortcoming: does not support multiple pages per view (multiple urls per view).

greets, attisan

ksenzee’s picture

Title: How to use Themekey with View Human Name » Themekey only works with a view's default display
Component: Documentation » Code / API
Issue tags: -themekey, -human name

In themekey_views_get_simple_property_by_getq(), Themekey tries to fetch a view's URL to match it against $_GET['q']. Unfortunately all it's getting back from the view is the URL for its default page display. If you have multiple page displays, with paths like "blog/category" and "blog/author", the Themekey rules you set up for the view won't be triggered.

One solution might be to add the ability to set up individual rules for each display, so you can specify "blog:page_1". This would let themekey_views_get_simple_property_by_getq() load the display in question and fetch its URL instead.

markabur’s picture

Version: 7.x-3.2 » 7.x-3.x-dev
Status: Active » Needs review
FileSize
771 bytes

Here's a patch that incorporates #9.

markabur’s picture

Status: Needs review » Needs work

Although the patch works for the parameterized views I was having trouble with, it causes problems for non-parameterized views.

I'm un-patching my copy of themekey and using a regex in the themekey rule instead.

pbuyle’s picture

Could views_get_page_view() be used here? Or does theme key happens too early?