Last active
August 29, 2015 14:20
-
-
Save timodwhit/b8aab8f5455b3a522ff1 to your computer and use it in GitHub Desktop.
Get a list of views of a certain type
This file contains hidden or 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
// Return an array of Data Export Views for a select list. | |
$vde_views = array(); | |
// It is true, there is no better way to parse the views. | |
$views = views_get_enabled_views(); | |
// Loop through each enabled views. | |
foreach ($views as $view) { | |
$id = $view->name; | |
$human_name = $view->human_name; | |
// Now loop through each display of each view. | |
foreach ($view->display as $display) { | |
// Only add it to the list if it is a views_data_export view. | |
if ($display->display_plugin == 'views_data_export') { | |
$friendly = $human_name . ': ' . $display->display_title; | |
$vde_views[$id . '--' . $display->id] = $friendly; | |
} | |
} | |
} | |
return $vde_views; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment