ise / ise-module-bootstrap
Twitter Bootstrap module for Zend Framework used by Internalsystemerror Limited
Requires
- php: ^5.6 || ^7.0
- nervo/yuicompressor: 2.4.7
- rwoverdijk/assetmanager: ^1.7
- zendframework/zend-form: ^2.5 || ^3.0
- zendframework/zend-navigation: ^2.5 || ^3.0
- zendframework/zend-view: ^2.5 || ^3.0
Requires (Dev)
- ise/php-metapackage-development: ^1.0
- zendframework/zend-i18n: ^2.6 || ^3.0
This package is auto-updated.
Last update: 2020-10-26 21:38:52 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.
- Form
- FormButton
- FormCheckbox
- FormColor
- FormDate
- FormDateSelect
- FormDateTime
- FormDateTimeLocal
- FormDateTimeSelect
- FormDescription
- FormElementErrors
- FormEmail
- FormFile
- FormImage
- FormInput
- FormMonth
- FormMonthSelect
- FormMultiCheckbox
- FormNumber
- FormPassword
- FormRange
- FormRow
- FormSearch
- FormSelect
- FormTel
- FormText
- FormTime
- FormUrl
- FormWeek
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