Skip to content

Blade Directives

Grafite CMS has some custom directives added to Blade which allows you to include files from your theme easily, as well as other parts.

@theme('path.to.view')

You can always add the cms-frontend:: namespace to the @include('path') or instead use @theme('path').

@block('slug')

Create unique and elegant designs with block directives in your templates for pages and blogs.

Warning

With the block blade directive you do not specify the module it needs to load, it determines that from the first string in the request URL. It will default to page if no matching module name matches the URL. In the case of something like events, it expects the variable in the template to be $event. It is wrapped in the optional method to protect the view from breaking the app.

Easily add menus to your views with the menu blade directive.

Generate links to modules automatically (Bootstrap 4 by default).

@widget('slug')

Add widgets to your views with the menu blade directive, just specify the SLUG.

@image('id', 'class')

Provides an image URL with an html tag and extra for adding a class

@image_link('ID')

Provides an image URL

@images('tag')

Images will be provided as an array, and if you skip the tag then the method will return all images, otherwise it follows the tagging.

@edit('module', 'id')

There is also the Grafite CMS Service which can be run inside your blade views. Its as simple as {{ Cms::method() }}

@markdown('content')

Convert your markdown blog or page entries into HTML.

Generate links for each supported lanugage in your website

Helper Methods Available:

  • menu('slug', 'optional-view-path')
  • images('tag')
  • widget('slug')
  • editBtn('module', 'id')