Commit 2c4bb921 authored by Marco Villegas's avatar Marco Villegas
Browse files

Issue #2040011: Prepare git specific module to provide default views.

parent 295dd463
Loading
Loading
Loading
Loading
+10 −0
Changes for versioncontrol_project_git/versioncontrol_project_git.module: 10 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -99,3 +99,13 @@ function versioncontrol_project_git_versioncontrol_code_arrival(VersioncontrolRe
    ));
  }
}

/**
 * Implements hook_views_api().
 */
function versioncontrol_project_git_views_api() {
  return array(
    'api' => 3,
    'path' => drupal_get_path('module', 'versioncontrol_project_git') . '/views',
  );
}
+25 −0
Changes for versioncontrol_project_git/views/versioncontrol_project_git.views_default.inc: 25 added lines, 0 removed lines.
Original line number Diff line number Diff line
<?php
/**
 * @file
 * Scans the 'default_views' subdirectory for default views by Version Control Project Git module.
 */

/**
 * Implements hook_views_default_views().
 */
function versioncontrol_project_git_views_default_views() {
  // Search the "default_views" subdirectory for files ending in .view.php.
  $files = file_scan_directory(drupal_get_path('module', 'versioncontrol_project_git') . '/views/default_views', '/view\.php$/');
  foreach ($files as $absolute => $file) {
    // This is not require_once because it's possible that
    // hook_views_default_views() gets called more than once.
    require DRUPAL_ROOT . '/' . $absolute;
    if (isset($view)) {
      // $file->name has the ".php" stripped off, but still has the ".view".
      $view_name = substr($file->name, 0, strrpos($file->name, '.'));
      $views[$view_name] = $view;
    }
  }
  return $views;
}