/**
* Registers the plugin's views
*
* @throws PluginException
* @return void
*/
protected function registerViews()
{
$views = _elgg_services()->views;
// Declared views first
$file = "{$this->path}/views.php";
if (is_file($file)) {
$spec = Includer::includeFile($file);
if (is_array($spec)) {
$views->mergeViewsSpec($spec);
}
}
$spec = $this->getStaticConfig('views');
if ($spec) {
$views->mergeViewsSpec($spec);
}
// Allow /views directory files to override
if (!$views->registerPluginViews($this->path, $failed_dir)) {
$key = 'ElggPlugin:Exception:CannotRegisterViews';
$args = [$this->getID(), $this->guid, $failed_dir];
$msg = _elgg_services()->translator->translate($key, $args);
throw new \PluginException($msg);
}
}