| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 | <?php// $Id$/** * @file * Implementation of hook_views_default_views(). * *//** * Implements hook_views_default_views(). * * @return array */function fgcf_views_default_views() {  // Needed to avoid fatal 'class view not found' error when Features  // checks the status of the feature.  // http://drupal.org/node/509174#comment-2715130  views_include('view');  $info = fgcf_views_api();  $path = $info['path'];  $defaults = basename(__FILE__);  $views = array();  foreach (new DirectoryIterator($path) as $file_info) {    if ($file_info->isDot()) {      continue;    }    $name = $file_info->getFilename();    if ($name == $defaults || !preg_match('/^fgcf_\w*\.php$/', $name, $matches)) {      continue;    }    // Cannot use require_once, as scanning may load them once before entering    // here, and they need to be reported each time.    require $name; // will define $view and $handler    if (!isset($view) || !isset($view->name)) {      watchdog('fgcf', 'Ill-formed view @name.', array('@name' => $name), WATCHDOG_NOTICE);    }    else {      $views[$view->name] = $view;    }    unset($view, $handler);  }  return $views;}
 |