Widgets

Lara CMS has a very flexible widget system.

Text widget

You can add text/html widgets, or you can add widgets that are automatically populated by a specific content-type.

Entity widget

Entity widgets are widgets that are automatically populated by a specific content-type. They are very useful for creating a list of blog items or a portfolio on your homepage. You can define the number of items, the use of images, tags, cache, etc.

Add widget in a template

Widgets can be added to a page by defining it in the template. Here is a simple example of a Text widget:

@include('larawidget', ['hook' => 'footer'])

And here is an example of an entity widget:

@widget('entityCacheWidget', ['entity_key' => 'portfolio', 'parent' => 'home', 'term' => '', 'needs_image' =>
		true, 'count' => 20, 'grid' => $data->grid])

Add widget in the Backend

If you add specific hooks to your templates, the webmaster will be able to add widgets dynamically to any page in the backend. The Demo theme has two hooks: content_top and content_bottom .

Last updated