Skip to content

Commit

Permalink
fix: replace global blade service
Browse files Browse the repository at this point in the history
  • Loading branch information
thorbrink committed Feb 26, 2024
1 parent 4d13976 commit 2e8cb55
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions Public.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,18 @@

// Public functions

use HelsingborgStad\GlobalBladeService\GlobalBladeService;
use ComponentLibrary\Init;

if (!function_exists('disturbance_render_blade_view')) {
function disturbance_render_blade_view($view, $data = [], $compress = true)
{
$bladeEngine = GlobalBladeService::getInstance([
APIALARMINTEGRATION_MODULE_VIEW_PATH,
]);
$viewPath = APIALARMINTEGRATION_MODULE_VIEW_PATH;
$componentLibrary = new Init([]);
$bladeEngine = $componentLibrary->getEngine();
$data = array_merge( $data, array('errorMessage' => false) );

try {
$markup = $bladeEngine->makeView(
$view,
array_merge(
$data,
array('errorMessage' => false)
)
)->render();
$markup = $bladeEngine->makeView( $view, $data, [], $viewPath )->render();
} catch (\Throwable $e) {
$markup .= '<pre style="border: 3px solid #f00; padding: 10px;">';
$markup .= '<strong>' . $e->getMessage() . '</strong>';
Expand Down

0 comments on commit 2e8cb55

Please sign in to comment.