Skip to content

Commit

Permalink
fix: replace global blade service (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
thorbrink authored Feb 26, 2024
1 parent 6d95430 commit 4004f5c
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions Public.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,19 @@

// Public functions


use HelsingborgStad\GlobalBladeService\GlobalBladeService;
use ComponentLibrary\Init as ComponentLibraryInit;

if (!function_exists('algolia_search_page_render_blade_view')) {
function algolia_search_page_render_blade_view($view, $data = [], $compress = true)
{
$markup = "";

$bladeEngine = GlobalBladeService::getInstance([
ALGOLIAINDEXJSSEARCHPAGE_VIEW_PATH
]);
$viewPath = ALGOLIAINDEXJSSEARCHPAGE_VIEW_PATH;
$data = array_merge( $data, array('errorMessage' => false) );
$componentLibrary = new ComponentLibraryInit([]);
$bladeEngine = $componentLibrary->getEngine();

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 4004f5c

Please sign in to comment.