Skip to content

adamlundrigan/LdcContentBlock

Repository files navigation

LdcContentBlock


Latest Stable Version Total Downloads Latest Unstable Version License Build Status Code Coverage Scrutinizer Code Quality


What?

LdcContentBlock provides an easy mechanism for adding view layer content blocks that receive and render ViewModels sent to them.

What?

An example use case: Say your module provides a dashboard. Adding an LdcContentBlock to the page will allow other modules in the system to hook into that block and display their own custom widgets without having to modify the source of the module providing the dashboard itself.

How?

  1. Install the Composer package:

    composer require adamlundrigan/ldc-content-block:1.*@stable
    
  2. Enable the module (LdcContentBlock) in your ZF2 application.

  3. Add a content block to one of your view scripts:

    <?=$this->renderContentBlock('my_block_name'); ?>
    
  4. Configure something to inject into the block

    1. Create a new model to inject and register it (example)

    2. Add the view model key to the block configuration (example)

  5. Profit!

Show me!

If you're fortunate enough to be on a *nix system with PHP >=5.4, pop into the demo folder and run the setup script (run.sh). This will build the demo application, install the example modules, and start a webserver. Once that's all done just open your browser and navigate to http://localhost:8080/ to see the blocks in action!

About

Pluggable view blocks for ZF2 applications

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published