Skip to content

Commit

Permalink
Blade @Inject
Browse files Browse the repository at this point in the history
  • Loading branch information
sdebacker committed Jun 4, 2015
1 parent ad2c47c commit 5235250
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions src/Providers/ModuleProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});

}
}
2 changes: 1 addition & 1 deletion src/resources/views/public/index.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@extends('pages::public.master')
<?php $page = TypiCMS::getPageLinkedToModule('places') ?>
@inject('page', 'typicms.places.page')

@section('bodyClass', 'body-places body-places-index body-page body-page-' . $page->id)

Expand Down
2 changes: 1 addition & 1 deletion src/resources/views/public/show.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@extends('core::public.master')
<?php $page = TypiCMS::getPageLinkedToModule('places') ?>
@inject('page', 'typicms.places.page')

@section('title', $model->title . '' . trans('news::global.name') . '' . $websiteTitle)
@section('ogTitle', $model->title)
Expand Down

0 comments on commit 5235250

Please sign in to comment.