ise/ise-module-bootstrap

Twitter Bootstrap module for Zend Framework used by Internalsystemerror Limited

dev-develop / 1.1.x-dev 2018-06-18 19:17 UTC

This package is auto-updated.

Last update: 2020-06-26 21:01:19 UTC


README

Introduction

This module intends to integrate Twitter Bootstrap with Zend Framework 2 and offers general view helpers, navigation view helpers and form view helpers.

Requirements

This module uses AssetManager, and by default, comes set up to use YuiCompressor to compress assets.

Installation

Installation of this module uses composer.

php composer.phar require ise/ise-module-bootstrap

Then add the following modules into your Zend Framework configuration.

  • AssetManager
  • Ise\Bootstrap

Usage

Form View Helpers

The following form view helpers are registered by default, which override those provided by Zend Framework, and can be used in their place. All elements will have the appropriate bootstrap style classes added to them.

An entire form can easily be rendered as follows:

/**
 * Where $form implements Zend\Form\FormInterface
 */
echo $this->form($form);

View Helpers

The bootstrap CSS/JS and meta tags are added by usage of a DispatchListener. The following view helpers are registered by default.

Note: The Time plugin uses jQuery Timeago to display time as "2 minutes ago" for instance.

Navigation View Helpers

The following navigation view helpers are registered by default.

You can use the navbar helper as follows:

/**
 * Where $container is a valid navigation container name, such as
 * 'default_navigation', if using the default ZF2 navigation factory.
 *
 * To have some of the links floated to the right (a login button for instance),
 * you can pass in the 'rightMenu' option to point to another navigation
 * container instance.
 */
echo $this->navigation($container)->navbar()->render(null, [
    'brand'     => [
        'label' => 'Your Brand Name Here',
        'route' => 'home',
        'icon'  => 'th-large', // Or any other icon name that would be prefixed glyphicon-*
    ],
    'inverse'   => true,
    'fixed'     => 'top',
    'rightMenu' => $anotherContainer,
]);

Credits

Made by Internalsystemerror Limited, and released under the BSD 3-Clause License