Last active
November 18, 2015 14:01
-
-
Save opdavies/f902b7f4bb2e92dce1be to your computer and use it in GitHub Desktop.
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
<?php | |
use Symfony\Component\Finder\Finder; | |
/** | |
* Implements hook_views_default_views(). | |
*/ | |
function MYMODULE_views_default_views() { | |
// Find all .view.inc files in a the views/ directory, and include them. | |
$finder = new Finder(); | |
$finder->files()->name('*.view.inc')->in(__DIR__ . '/views'); | |
$views = array(); | |
foreach ($finder as $file) { | |
require $file->getRealPath(); | |
if (isset($view)) { | |
$views[$view->name] = $view; | |
} | |
} | |
return $views; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment