toa / twitter-bootstrap-bundle
Twitter Bootstrap 基本集成到 Symfony2
Requires
- sensio/generator-bundle: >=2.1,<2.3-dev
This package is not auto-updated.
Last update: 2024-09-14 13:15:29 UTC
README
此包已不再维护。请使用 PUGXGeneratorBundle 等。
此包提供将 Twitter Bootstrap(v2.2.0) 基本集成到 Symfony 标准版 的功能。
它包含一个基于 SensioGeneratorBundle 的 CRUD 生成器。
安装
将 toa/twitter-bootstrap-bundle
添加到 composer.json
。
{
"require": {
// ...
"toa/twitter-bootstrap-bundle": "dev-master",
// ...
}
}
在 app/AppKernel.php
中注册此包
public function registerBundles()
{
$bundles = array(
// ...
new Toa\Bundle\TwitterBootstrapBundle\ToaTwitterBootstrapBundle(),
// ...
);
}
使用方法
CRUD 生成
位于 ToaTwitterBootstrapBundle 中的 CRUD 生成器基于 SensioGeneratorBundle。
使用 php ./app/console doctrine:generate:crud
代替
可以使用 php ./app/console toa:generate:twitter-bootstrap-crud
具有相同的选项和参数。
模板覆盖
默认 CRUD 模板位于 Resources/skeleton/crud,可以在 /app/Resources/ToaTwitterBootstrapBundle/skeleton/crud
中覆盖。
同样可以以这种方式覆盖 SensioGeneratorBundle 的基础模板。
示例 #1
所有生成的视图都继承自 ToaTwitterBootstrapBundle::layout.html.twig
,可以在 /app/Resources/ToaTwitterBootstrapBundle/skeleton/crud/views/others/extends.twig.twig
中覆盖。
示例 #2
所有生成的视图都使用 content
块,可以在 /app/Resources/ToaTwitterBootstrapBundle/skeleton/crud/views/others/block.twig.twig
中覆盖。