ise/ise-module-bootstrap

该软件包已被废弃,不再维护。未建议替代包。

Internalsystemerror Limited使用的Twitter Bootstrap模块,用于Zend Framework

dev-master / 1.0.x-dev 2018-06-18 13:47 UTC

This package is auto-updated.

Last update: 2020-10-26 21:38:52 UTC


README

简介

此模块旨在将Twitter Bootstrap集成到Zend Framework 2中,并提供通用的视图辅助工具、导航视图辅助工具和表单视图辅助工具。

需求

此模块使用AssetManager,默认设置为使用YuiCompressor压缩资源。

安装

此模块的安装使用composer。

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

然后,将以下模块添加到您的Zend Framework配置中。

  • AssetManager
  • Ise\Bootstrap

使用方法

表单视图辅助工具

以下表单视图辅助工具默认注册,可以替代由Zend Framework提供的辅助工具,并可用于替代。所有元素都将添加适当的Bootstrap样式类。

以下是如何轻松渲染整个表单的示例

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

视图辅助工具

通过使用DispatchListener添加Bootstrap CSS/JS和meta标签。以下视图辅助工具默认注册。

注意:时间插件使用jQuery Timeago来显示时间,例如“2分钟前”。

导航视图辅助工具

以下导航视图辅助工具默认注册。

您可以使用以下方式使用导航栏辅助工具

/**
 * 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,
]);

致谢

Internalsystemerror Limited制作,并按照BSD 3-Clause License发布