fgcf.views_default.inc 834 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. // $Id$
  3. /**
  4. * @file
  5. * Implementation of hook_views_default_views().
  6. *
  7. */
  8. /**
  9. * Implements hook_views_default_views().
  10. *
  11. * @return array
  12. */
  13. function fgcf_views_default_views() {
  14. // Needed to avoid fatal 'class view not found' error when Features
  15. // checks the status of the feature.
  16. views_include('view');
  17. $info = fgcf_views_api();
  18. $path = $info['path'];
  19. $defaults = basename(__FILE__);
  20. $views = array();
  21. foreach (new DirectoryIterator($path) as $file_info) {
  22. if ($file_info->isDot()) {
  23. continue;
  24. }
  25. $name = $file_info->getFilename();
  26. if ($name == $defaults || !preg_match('/^fgcf_\w*\.php$/', $name, $matches)) {
  27. continue;
  28. }
  29. require_once $name; // will define $view and $handler
  30. $views[$view->name] = $view;
  31. unset($view, $handler);
  32. }
  33. return $views;
  34. }