From 2011a731788dff5f029e3fc4dc0f361738295f61 Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Thu, 4 Jun 2015 23:18:52 +0200 Subject: [PATCH] Blade @inject --- src/Providers/ModuleProvider.php | 10 ++++++++++ src/resources/views/public/index.blade.php | 2 +- src/resources/views/public/show.blade.php | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Providers/ModuleProvider.php b/src/Providers/ModuleProvider.php index 254d72a..ca5bc5a 100644 --- a/src/Providers/ModuleProvider.php +++ b/src/Providers/ModuleProvider.php @@ -73,6 +73,9 @@ public function register() return new CacheDecorator($repository, $laravelCache); }); + /** + * Calendar service + */ $app->bind('TypiCMS\Modules\Events\Services\Calendar', function () { return new Calendar( new EluceoCalendar('TypiCMS'), @@ -80,5 +83,12 @@ public function register() ); }); + /** + * Return the page linked to this module (for @inject in views) + */ + $app->singleton('typicms.events.page', function (Application $app) { + return TypiCMS::getPageLinkedToModule('events'); + }); + } } diff --git a/src/resources/views/public/index.blade.php b/src/resources/views/public/index.blade.php index 9d41708..783a195 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.events.page') @section('bodyClass', 'body-events body-events-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 fc2e1c8..60041b2 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.events.page') @section('title', $model->title . ' – ' . trans('news::global.name') . ' – ' . $websiteTitle) @section('ogTitle', $model->title)