2017 © Pedro Peláez
 

symfony-bundle bootstrap-bundle

Unobtrusive support for Bootstrap 3 - Compatible with Symfony 3.x

image

sameddin/bootstrap-bundle

Unobtrusive support for Bootstrap 3 - Compatible with Symfony 3.x

  • Thursday, September 15, 2016
  • by sameddin
  • Repository
  • 3 Watchers
  • 10 Stars
  • 12,102 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 1 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

ElnurBootstrapBundle

This bundle provides unobtrusive support for Bootstrap 3. By “unobtrusive” I mean that it doesn't force some particular styling unless you explicitly tell it to. For example, by default, forms get the default Bootstrap layout — not horizontal or something else like that., (*1)

Installation

The bundle assumes that you install Bootstrap yourself by whatever means you like — be it a Composer package or via Bower., (*2)

To install the bundle itself, add the following to your composer.json:, (*3)

{
    "require": {
        "elnur/bootstrap-bundle": "~0.1"
    }
}

And tell Composer to install the bundle:, (*4)

$ php composer.phar update elnur/bootstrap-bundle

Then enable the bundle by adding the following to your AppKernel.php:, (*5)

public function registerBundles()
{
    $bundles = array(
        // ...
        new Elnur\Bundle\BootstrapBundle\ElnurBootstrapBundle,
    );

    // ...
}

Forms

To render a form with the default Bootstrap layout, just do the following:, (*6)

{{ form(form) }}

If you want to use another layout — say, horizontal — tell about that explicitly:, (*7)

{{ form(form, {layout: 'horizontal'}) }}

Supported layouts are:, (*8)

  • default,
  • horizontal,
  • inline, and
  • navbar.

Buttons

Context

To set a button's context, use the context option:, (*9)

$builder->add('submit', 'submit', array(
    'context' => 'primary',
));

Bootstrap ships with the following contexts:, (*10)

  • default,
  • primary,
  • success,
  • info,
  • warning,
  • danger, and
  • link.

Input groups

To prepend or append textual addons to an input, use the prepend and append options, respectively:, (*11)

$builder->add('price', 'integer', array(
    'prepend' => '$',
    'append' => '.00',
));

Converting Labels to Placeholders

If you want to convert labels to placeholders, set the labels_to_placeholders option to true:, (*12)

{{ form(form, {labels_to_placeholders: true}) }}

Flash Messages

To render flash messages just add the following to your layout template:, (*13)

{% include 'ElnurBootstrapBundle::flash.html.twig' %}

The Versions

15/09 2016

v1.0.0

1.0.0.0

Unobtrusive support for Bootstrap 3 - Compatible with Symfony 3.x

  Sources   Download

MIT

The Requires

 

templating bootstrap

05/08 2014
05/08 2014
17/07 2014
10/07 2014
24/02 2014