You are here

function themekey_ui_get_path_theme in ThemeKey 7.3

Same name and namespace in other branches
  1. 6.4 themekey_ui_helper.inc \themekey_ui_get_path_theme()
  2. 6 themekey_ui_helper.inc \themekey_ui_get_path_theme()
  3. 6.2 themekey_ui_helper.inc \themekey_ui_get_path_theme()
  4. 6.3 themekey_ui_helper.inc \themekey_ui_get_path_theme()
  5. 7 themekey_ui_helper.inc \themekey_ui_get_path_theme()
  6. 7.2 themekey_ui_helper.inc \themekey_ui_get_path_theme()

Returns a theme assigned to a Drupal path alias using a ThemeKey Theme Switching Rule which is not part of a chain

Parameters

$path: Drupal path as string

Return value

array with two elements:

  • id of the database entry in table themekey_properties or '0' if no entry exists
  • the theme
1 call to themekey_ui_get_path_theme()
themekey_ui_pathalias in ./themekey_ui_admin.inc
Adds theme select box to url alias form

File

./themekey_ui_helper.inc, line 33

Code

function themekey_ui_get_path_theme($path) {
  $serialized_empty_array = serialize(array());
  if ($result = db_select('themekey_properties', 'tp')
    ->fields('tp', array(
    'id',
    'theme',
  ))
    ->condition('property', 'drupal:path')
    ->condition('operator', '=')
    ->condition('value', $path)
    ->condition('wildcards', $serialized_empty_array)
    ->condition('parent', 0)
    ->execute()) {
    foreach ($result as $row) {
      $query = db_select('themekey_properties', 'tp')
        ->condition('parent', $row->id);
      $query
        ->addExpression('COUNT(*)');
      if (!$query
        ->execute()
        ->fetchField()) {
        return array(
          $row->id,
          $row->theme,
        );
      }
    }
  }
  return array(
    0,
    'default',
  );
}