Developed with love by KnpLabs Hire us for your project!
743

MopaBootstrapBundle

by phiamo

Easy integration of twitters bootstrap into symfony2

MopaBootstrapBundle

Build Status
SensioLabsInsight
Coverage Status

MopaBootstrapBundle is a collection of code to integrate twitter's bootstrap
(http://twitter.github.com/bootstrap/) as easy as possible into your symfony
(http://www.symfony.com) Project.

To use MopaBootstrapBundle and Twitter's Bootstrap 3 in your project add it via composer

Updates

New in 3.1: The way horizontal works has been slightly altered due to a change in Symfony forms. This may or may
not affect some behavior of your existing forms. ALL root form elements, whether they have a parent form or not will
start with horizontal === true (or whatever value you set in the config). For the most part this shouldn't affect many users.

horizontal will also correctly pass itself down to collection types (and all child forms). So if your collection is horizontal,
so will the collection items. If you want your collection items only to be inline, then you can pass these options to your collection:

array(
    'entry_options' => array('horizontal' => false), //   2.8+
    'options' => array('horizontal' => false),       // < 2.8
)

horizontal_wrap_children has been removed, as this can be solved using the above options.

Branches

To use this bundle with bootstrap 3 use the latest release:

composer require mopa/bootstrap-bundle twbs/bootstrap

Or config via composer.json

For LESS:

{
    "require": {
        "mopa/bootstrap-bundle": "~3.0",
        "twbs/bootstrap": "~3.3.0"
    }
}

For SASS:

{
    "require": {
        "mopa/bootstrap-bundle": "~3.0",
        "twbs/bootstrap-sass": "~3.3.0"
    }
}

If you wish to use the current master branch, then use the following:

composer require mopa/bootstrap-bundle:dev-master twbs/bootstrap:dev-master

For bootstrap 2 use the v2.3.x branch:

composer require mopa/bootstrap-bundle:2.3.x-dev twbs/bootstrap:2.3.2

To understand which versions are currently required have a look into BRANCHES.md

Documentation

The bulk of the documentation is stored in the Resources/doc folder in this bundle
In any case, if something is not working as expected after a update:

Live Show

To see the bundle, its capabilities and some more doc just have a look on

MopaBootstrapBundle Live

Additional Resources:

Installation

Installation instructions are located in the

Included Features

  • Bootstrap Version detection via Composer Bridge
  • Twig Extensions and templates for use with symfony2 Form component
    • control your form either via the form builder or the template engine
    • control nearly every bootstrap2 form feature
    • javascript and twig blocks for dynamic collections
  • A generic Navbar class to generate your Navbar outside the template
    • helpers for dropdowns, seperators, etc.
  • A generic Tab class to Manage bootstrap tabbing
  • Twig templates for KnpPaginatorBundle (https://github.com/knplabs/KnpPaginatorBundle)
  • Twig templates for CraueFormFlowBundle (https://github.com/craue/CraueFormFlowBundle)
  • Twig template for KnpMenuBundle (https://github.com/KnpLabs/KnpMenuBundle)
    • icon support on menu links

Translations

If you use KnpPaginatorBundle with MopaBootstrapBundle, you can translate labels to your language.
To do this add new file

Resources/translations/pagination.[YOUR LOCALE CODE].yml

As example you have there Polish translation.

Versioning

We aim to follow semantic versioning with our releases.

Contribute

If you want to contribute your code to MopaBootstrapBundle please be sure that your PR's
are valid to Symfony2.1 Coding Standards. You can automatically fix your code for that
with PHP-CS-Fixer tool.

You can see who already contributed to this project on Contributors page

License

This bundle is under the MIT license. For more information, see the complete LICENSE file in the bundle.

Copyright (c) 2015 Mohrenweiser & Partner, Philipp A. Mohrenweiser
- http://www.mohrenweiserpartner.de

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
mopa_bootstrap:
form:
allow_legacy: false
templating: @MopaBootstrap/Form/fields.html.twig

# Default form layout
layout: horizontal
horizontal_label_class: col-sm-3
horizontal_label_div_class: ~
horizontal_label_offset_class: col-sm-offset-3
horizontal_input_wrapper_class: col-sm-9
date_wrapper_class:
year: col-xs-4
month: col-xs-4
day: col-xs-4
render_fieldset: true
render_collection_item: true
show_legend: true
show_child_legend: false
legend_tag: legend
checkbox_label: both
render_optional_text: true
render_required_asterisk: false
error_type: ~
tabs:
class: nav nav-tabs
help_widget:
popover:
title: ~
content: ~
trigger: hover
toggle: popover
placement: right
selector: ~
help_label:
tooltip:
title: ~
text: ~
icon: info-sign
placement: top
popover:
title: ~
content: ~
text: ~
icon: info-sign
placement: top
help_block:
tooltip:
title: ~
text: ~
icon: info-sign
placement: top
popover:
title: ~
content: ~
text: ~
icon: info-sign
placement: top
collection:
widget_remove_btn:
attr:
class: btn btn-default
wrapper_div:
class: form-group
horizontal_wrapper_div:
class: col-sm-3 col-sm-offset-3
label: remove_item
translation_domain: ~
icon: ~
icon_inverted: false
widget_add_btn:
attr:
class: btn btn-default
label: add_item
translation_domain: ~
icon: ~
icon_inverted: false
icons:

# Icon set to use: ["glyphicons","fontawesome","fontawesome4","zmdi"]
icon_set: glyphicons

# Alias for mopa_bootstrap_icon()
shortcut: icon
menu:
enabled: false

# Menu template to use when rendering
template: @MopaBootstrap/Menu/menu.html.twig
navbar:
enabled: false

# Menu template to use when rendering
template: @MopaBootstrap/Menu/menu.html.twig
initializr:
meta:
title: MopaBootstrapBundle
description: MopaBootstrapBundle
keywords: MopaBootstrapBundle, Twitter Bootstrap, HTML5 Boilerplate
author_name: My name
author_url: #
feed_atom: ~
feed_rss: ~
sitemap: ~
nofollow: false
noindex: false
dns_prefetch:

# Default:
- //ajax.googleapis.com
google:
wt: ~
analytics: ~
extendedanalytics: false
diagnostic_mode: false
flash:
mapping:
success:

# Default:
- success
danger:

# Defaults:
- error
- danger
warning:

# Defaults:
- warning
- warn
info:

# Defaults:
- info
- notice
  • Register commands as services (#1231)
    By isometriks, 4 months ago
  • Fix renderer tests (#1228)
    By web-flow, 11 months ago
  • Avoid missing translation notices (#1226)
    By isometriks, 11 months ago
  • Add support for symfony Flex (#1225)
    By isometriks, 1 year ago
  • Symfony 4 compatibility (#1223)
    By isometriks, 1 year ago
  • Update README (#1221)
    By isometriks, 1 year ago
  • Add versioning to README (#1220)
    By isometriks, 1 year ago
  • Fix some travis tests and account for more symfony versions. (#1218)
    By web-flow, 1 year ago
  • Update deprecated sameas twig test (#1215)
    By isometriks, 1 year ago
  • Replace 'horizontal' option with 'layout' (#1044)
    By isometriks, 1 year ago
  • Use choice_translation_domain option (#1138)
    By isometriks, 1 year ago
  • add current bootstraps required classes for an inline toggle button
    By phiamo, 1 year ago
  • make these calls dependent on method existance, dont depend on class thats maybe not in namespace
    By phiamo, 1 year ago
  • Merge pull request #1184 from core23/patch/disable-label-translation
    By web-flow, 1 year ago
  • Allow twig2 (#1205)
    By isometriks, 1 year ago
  • Try to fix travis tests (#1210)
    By web-flow, 1 year ago
  • Fix expanded widget inline-btn to use buttons when widget type set. (#1209)
    By web-flow, 1 year ago
  • Merge pull request #1170 from n1c01a5/master
    By web-flow, 1 year ago
  • Merge pull request #1186 from corphi/master
    By web-flow, 1 year ago
  • Merge pull request #1190 from mulcek/mulcek-translation-patch
    By web-flow, 1 year ago
  • Merge pull request #1207 from phiamo/feature/insight
    By web-flow, 1 year ago
  • make insight happy
    By phiamo, 1 year ago
  • make inline buttons abled to be disabled
    By phiamo, 1 year ago
  • Added horizontal_label_div_class to test (#1202)
    By isometriks, 2 years ago
  • Fix #1199
    By isometriks, 2 years ago
  • Merge pull request #1199 from stephanvierkant/master
    By web-flow, 2 years ago
  • Merge remote-tracking branch 'stephanvierkant/master' into master-stephanvierkant
    By stephanvierkant, 2 years ago
  • Using .length() instead of .size(). Fixes #1198
    By stephanvierkant, 2 years ago
  • Using .length() instead of .size(). Fixes #1198
    By stephanvierkant, 2 years ago
  • Add tests to tabs markup (#1197)
    By web-flow, 2 years ago