2017 © Pedro Peláez
 

asgard-module block

A module to create small blocks of content to display anywhere on the site.

image

asgardcms/block

A module to create small blocks of content to display anywhere on the site.

  • Tuesday, May 15, 2018
  • by nWidart
  • Repository
  • 6 Watchers
  • 12 Stars
  • 3,649 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 21 Forks
  • 0 Open issues
  • 26 Versions
  • 4 % Grown

The README.md

Block Module

Latest Version Software License Quality Sblock SensioLabs Insight CodeClimate Total Downloads Slack, (*1)

Branch Travis-ci
master Build Status
2.0 Build Status

Installation

Download

You can install the Block module, with the following command which allows the module to be edited for your project., (*2)

``` sh php artisan asgard:download:module asgardcms/block --migrations, (*3)


### Composer You can install the Block module with composer: ```sh $ composer require asgardcms/block

Then run the following command to install the database tables:, (*4)

$ php artisan module:migrate Block

Permissions

In the backend GUI, go to Users > Roles > Admin. Then the permissions tab, and give the Admin role the permissions for the block module., (*5)

Documentation

This is a very simple module to create re-usable blocks of content. The blocks of content are created in the administration. You give it a name and a content., (*6)

After this, you'll be able to get the content of a block with the following code:, (*7)

``` php {!! Block::get('block-name') !!}, (*8)


Each block also receives a shortcode that can be used instead of the code mentioned above. Shortcode looks like this `[[BLOCK(block-name)]]`. This is very useful if you for example want to allow users to reuse and enter blocks into content of the WYSIWYG editor (page or blog article body) If you want to use shortcodes in your app, you need to register `RenderBlock` middleware responsible for parsing the response and replacing the shortcodes with the actual block content. It can be done globally by editing `app/Http/Kernel.php` file and adding `\Modules\Block\Http\Middleware\RenderBlock::class` into the `$middlewareGroups` `web` group (this way, block shortcodes will be automatically replaced in all `web` routes on frontend): ```php <?php // app/Http/Kernel.php ... protected $middlewareGroups = [ 'web' => [ ... \Modules\Block\Http\Middleware\RenderBlock::class, ] ... }

There are some drawbacks to this approach, specifically that each response will be parsed and searched for the shortcodes before returning back to the user, which may slightly slow down your application. If you know that you do not need to use shortcodes in the whole app, middleware can be applied selectively only to some routes or route groups in your application:, (*9)

get('your-url', 'YourController@method')
        ->middleware(\Modules\Block\Http\Middleware\RenderBlock::class);
    ...
    // middleware will be applied to whole group
    $router->group(['middleware' => \Modules\Block\Http\Middleware\RenderBlock::class], function(Router $router) {
        $router->get('your-url', 'YourController@method');
        ...
    });
    ...
?>

Keep in mind that by allowing users to put blocks/shortcodes anywhere, you are creating a potential security issue, so use this functionality carefully., (*10)

Hooks

Hooks are special events, where it allows you to change the data stored before it's stored in the database., (*11)

BlockIsCreating

Triggered before a block is created., (*12)

BlockIsUpdating

Triggered before a block is updated., (*13)

BlockContentIsRendering

Triggered when a block body gets displayed., (*14)

Resources

Info

All AsgardCMS modules respect Semantic Versioning., (*15)

The Versions

15/05 2018

dev-master

9999999-dev

A module to create small blocks of content to display anywhere on the site.

  Sources   Download

MIT

The Requires

 

The Development Requires

04/10 2017

3.0.0

3.0.0.0

A module to create small blocks of content to display anywhere on the site.

  Sources   Download

MIT

The Requires

 

The Development Requires

31/07 2017

2.0.x-dev

2.0.9999999.9999999-dev

A module to create small blocks of content to display anywhere on the site.

  Sources   Download

MIT

The Requires

 

The Development Requires

31/07 2017

2.2.0

2.2.0.0

A module to create small blocks of content to display anywhere on the site.

  Sources   Download

MIT

The Requires

 

The Development Requires

31/07 2017

2.1.2

2.1.2.0

A module to create small blocks of content to display anywhere on the site.

  Sources   Download

MIT

The Requires

 

The Development Requires

27/07 2017

2.1.1

2.1.1.0

A module to create small blocks of content to display anywhere on the site.

  Sources   Download

MIT

The Requires

 

The Development Requires

27/07 2017

2.1.0

2.1.0.0

A module to create small blocks of content to display anywhere on the site.

  Sources   Download

MIT

The Requires

 

The Development Requires

15/06 2017

2.0.0

2.0.0.0

A module to create small blocks of content to display anywhere on the site.

  Sources   Download

MIT

The Requires

 

The Development Requires

08/06 2016

1.13.0

1.13.0.0

A module to create small blocks of content to display anywhere on the site.

  Sources   Download

MIT

The Requires

 

The Development Requires

08/06 2016

1.0.x-dev

1.0.9999999.9999999-dev

A module to create small blocks of content to display anywhere on the site.

  Sources   Download

MIT

The Requires

 

The Development Requires

06/05 2016

1.12.0

1.12.0.0

A module to create small blocks of content to display anywhere on the site.

  Sources   Download

MIT

The Requires

 

The Development Requires

21/12 2015

1.11.0

1.11.0.0

A module to create small blocks of content to display anywhere on the site.

  Sources   Download

MIT

The Requires

 

The Development Requires

07/12 2015

1.10.0

1.10.0.0

A module to create small blocks of content to display anywhere on the site.

  Sources   Download

MIT

The Requires

 

The Development Requires

27/11 2015

1.9.0

1.9.0.0

A module to create small blocks of content to display anywhere on the site.

  Sources   Download

MIT

The Requires

 

The Development Requires

27/11 2015

1.8.1

1.8.1.0

A module to create small blocks of content to display anywhere on the site.

  Sources   Download

MIT

The Requires

 

The Development Requires

15/11 2015

1.7.0

1.7.0.0

A module to create small blocks of content to display anywhere on the site.

  Sources   Download

MIT

The Requires

 

The Development Requires

15/11 2015

1.8.0

1.8.0.0

A module to create small blocks of content to display anywhere on the site.

  Sources   Download

MIT

The Requires

 

The Development Requires

27/10 2015

1.6.0

1.6.0.0

A module to create small blocks of content to display anywhere on the site.

  Sources   Download

MIT

The Requires

 

The Development Requires

26/08 2015

1.5.0

1.5.0.0

A module to create small blocks of content to display anywhere on the site.

  Sources   Download

MIT

The Requires

 

The Development Requires

08/07 2015

1.4.0

1.4.0.0

A module to create small blocks of content to display anywhere on the site.

  Sources   Download

MIT

The Requires

 

The Development Requires

07/07 2015

1.3.0

1.3.0.0

A module to create small blocks of content to display anywhere on the site.

  Sources   Download

MIT

The Requires

 

The Development Requires

04/07 2015

1.2.0

1.2.0.0

A module to create small blocks of content to display anywhere on the site.

  Sources   Download

MIT

The Requires

 

The Development Requires

21/06 2015

1.0.3

1.0.3.0

A module to create small blocks of content to display anywhere on the site.

  Sources   Download

MIT

The Requires

 

The Development Requires

11/06 2015

1.0.2

1.0.2.0

A module to create small blocks of content to display anywhere on the site.

  Sources   Download

MIT

The Requires

 

The Development Requires

10/06 2015

1.0.1

1.0.1.0

A module to create small blocks of content to display anywhere on the site.

  Sources   Download

MIT

The Requires

 

The Development Requires

09/06 2015

1.0.0

1.0.0.0

A module to create small blocks of content to display anywhere on the site.

  Sources   Download

MIT

The Requires

 

The Development Requires