Created
March 28, 2014 01:03
-
-
Save m7v/9822817 to your computer and use it in GitHub Desktop.
Views takes $_GET. {Hack}
//Creating Ctools plugin that is retrieve views result by GET-parameters.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Callback function to supply a list of content types. | |
*/ | |
function spaint_site_changelog_ctools_content_types() { | |
return array( | |
'single' => TRUE, | |
'title' => t('Changelog'), | |
'description' => t('Changelog CTools CT'), | |
'category' => t('spaint_site'), | |
'all contexts' => TRUE, | |
'defaults' => array('mode' => 'full'), | |
); | |
} | |
/** | |
* Output function for the content type | |
*/ | |
function spaint_site_changelog_content_type_render($subtype, $conf, $panel_args, $contexts) { | |
$block = new stdClass(); | |
$platforms = taxonomy_get_tree(SPAINT_SITE_PLATFORM_VOCABULARY); | |
$versions = taxonomy_get_tree(SPAINT_SITE_PLATFORM_VOCABULARY); | |
$view = views_get_view('changelog'); | |
foreach ($platforms as $platform) { | |
if ($platform->name == $_GET['os']) { | |
$os = $platform->tid; | |
} | |
} | |
foreach ($versions as $version) { | |
if ($version->name == $_GET['version']) { | |
$v = $version->tid; | |
} | |
} | |
$output = $view->preview('master', array($os, $v)); | |
$block->content = $output; | |
return $block; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment