Code Monkey home page Code Monkey logo

bootforms's Introduction

Bootforms

Bootstrap form field generator for Laravel 4. Bootforms will add "controls", labels, and "group" html elements to your form fields to make integration with Bootstrap quicker and easier.

Turning This:

{{ Bootform::field(array(
  'label'       => "Full Name",
  'name'        => "name",
)) }}
{{ Bootform::field(array(
	'label'       => "Email Address",
	'name'        => "email",
	'input-prepend' => '<i class="icon-envelope"></i>',
	'input-attributes' => array('placeholder' => "[email protected]"),
	'input-class' => "input-large"
  )) }}

Into This:

<div class="control-group field-group-text control-group-name">
  <label for="name" class="control-label ">Full Name</label>
  <div class="controls" >
    <input class="" name="name" type="text" value="">
  </div>
</div>
<div class="control-group  field-group-text control-group-email">
  <label for="email" class="control-label ">Email Address</label>
  <div class="controls input-prepend" >
    <span class="add-on"><i class="icon-envelope"></i></span>
    <input class="input-large" placeholder="[email protected]" name="email" type="text" value="">
  </div>
</div>

Bootforms uses Laravel's Form class to generate form fields.

Installation

Add kilrizzy/bootforms to composer.json.

"kilrizzy/bootforms": "dev-master"

Run composer update to pull down the latest version of Bootforms.

Open app/config/app.php and add service provider:

'kilrizzy\bootforms\BootformsServiceProvider',

In app/config/app.php add alias:

'Bootform' => 'Kilrizzy\Bootforms\BootformsFacade',

Usage

Pass an array of field data to Bootforms to generate html using the following options:

$options = array(
  'type' => "text", //field input type (text, textarea, password, select, checkbox, radio, file)
  'name' => "", //field input name
  'id' => "", //field input id
  'value' => "", //field input value
  'label' => "", //field label
  'help' => "", //field help display text
  'label-class' => "", //label class
  'group' => true, //wrap group
  'group-class' => "", //class applied to the group container
  'group-attributes' => array(), //additional group attributes
  'controls' => true, //wrap controls
  'controls-class' => "", //class applied to the controls container
  'controls-attributes' => array(), //additional controls attributes
  'input-class' => "", //class applied to the input
  'input-attributes' => array(), //additional input attributes
  'input-prepend' => "", //prepend control data
  'input-append' => "", //append control data
);

Take a look at demo/bootforms.blade.php for an example view

bootforms's People

Contributors

kilrizzy avatar

Watchers

Neil Crookes avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.