Skip to content

Instantly share code, notes, and snippets.

@bnchdrff
Created December 15, 2015 22:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save bnchdrff/8d4a1e71a94207a74cb0 to your computer and use it in GitHub Desktop.
Save bnchdrff/8d4a1e71a94207a74cb0 to your computer and use it in GitHub Desktop.
summarize all views on a drupal site
<?php
$views = [
[
'view machine name',
'view name',
'view desc',
'base table',
'display machine name',
'display title',
'display plugin',
]
];
foreach (views_get_all_views() as $view) {
foreach ($view->display as $display => $data) {
$views[] = [
// 'view machine name'
$view->name,
// 'view name'
$view->human_name,
// 'view desc'
$view->description,
// 'base table'
$view->base_table,
// 'display machine name'
$display,
// 'display title'
$data->display_title,
// 'display plugin'
$data->display_plugin,
];
}
}
$fp = fopen('views-summary.csv', 'w');
foreach ($views as $fields) {
fputcsv($fp, $fields);
}
fclose($fp);
@gl2748
Copy link

gl2748 commented Dec 15, 2015

Can you also show the initial command to display the structure of the view object...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment