1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-21 00:41:34 +02:00
invoiceninja/app/Helpers/ClientPortal.php

55 lines
1.2 KiB
PHP
Raw Normal View History

2020-03-23 18:10:42 +01:00
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
/**
* Check if passed page is currently active.
*
* @param $page
* @param bool $boolean
* @return bool
*/
function isActive($page, bool $boolean = false)
{
$current_page = Route::currentRouteName();
if ($page == $current_page && $boolean) {
2020-03-23 18:10:42 +01:00
return true;
}
2020-03-23 18:10:42 +01:00
if ($page == $current_page) {
2020-03-23 18:10:42 +01:00
return 'active-page';
}
2020-03-23 18:10:42 +01:00
return false;
}
/**
* New render method that works with themes.
*
* @param string $path
* @param array $options
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
function render(string $path, array $options = [])
{
$theme = array_key_exists('theme', $options) ? $options['theme'] : 'ninja2020';
if (array_key_exists('root', $options)) {
return view(
sprintf('%s.%s.%s', $options['root'], $theme, $path),
$options
);
2020-03-23 18:10:42 +01:00
}
return view("portal.$theme.$path", $options);
}