From 5235250186aa078cdc3d0163cfe6781bfa4cc4b0 Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Thu, 4 Jun 2015 23:17:51 +0200 Subject: [PATCH] Blade @inject --- src/Providers/ModuleProvider.php | 7 +++++++ src/resources/views/public/index.blade.php | 2 +- src/resources/views/public/show.blade.php | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Providers/ModuleProvider.php b/src/Providers/ModuleProvider.php index bbcac9a..d64c1bc 100644 --- a/src/Providers/ModuleProvider.php +++ b/src/Providers/ModuleProvider.php @@ -73,5 +73,12 @@ public function register() return new CacheDecorator($repository, $laravelCache); }); + /** + * Return the page linked to this module (for @inject in views) + */ + $app->singleton('typicms.places.page', function (Application $app) { + return TypiCMS::getPageLinkedToModule('places'); + }); + } } diff --git a/src/resources/views/public/index.blade.php b/src/resources/views/public/index.blade.php index a1f83d7..aa0a183 100644 --- a/src/resources/views/public/index.blade.php +++ b/src/resources/views/public/index.blade.php @@ -1,5 +1,5 @@ @extends('pages::public.master') - +@inject('page', 'typicms.places.page') @section('bodyClass', 'body-places body-places-index body-page body-page-' . $page->id) diff --git a/src/resources/views/public/show.blade.php b/src/resources/views/public/show.blade.php index 8685274..8890a80 100644 --- a/src/resources/views/public/show.blade.php +++ b/src/resources/views/public/show.blade.php @@ -1,5 +1,5 @@ @extends('core::public.master') - +@inject('page', 'typicms.places.page') @section('title', $model->title . ' – ' . trans('news::global.name') . ' – ' . $websiteTitle) @section('ogTitle', $model->title)