Migrating from 4.1 to version 5 might include an awful lot of work. Version 4.1 will be supported for the foreseeable future but will only contain patch fixes.
app.php
aliases
First, you'll need to update your app.php
. Remove all Bootstrapper aliases and replace them with
the following:
'Accordion' => 'Bootstrapper\Facades\Accordion', 'Alert' => 'Bootstrapper\Facades\Alert', 'Badge' => 'Bootstrapper\Facades\Badge', 'Breadcrumb' => 'Bootstrapper\Facades\Breadcrumb', 'Button' => 'Bootstrapper\Facades\Button', 'ButtonGroup' => 'Bootstrapper\Facades\ButtonGroup', 'Carousel' => 'Bootstrapper\Facades\Carousel', 'ControlGroup' => 'Bootstrapper\Facades\ControlGroup', 'DropdownButton' => 'Bootstrapper\Facades\DropdownButton', 'Form' => 'Bootstrapper\Facades\Form', 'Helpers' => 'Bootstrapper\Facades\Helpers', 'Icon' => 'Bootstrapper\Facades\Icon', 'InputGroup' => 'Bootstrapper\Facades\InputGroup', 'Image' => 'Bootstrapper\Facades\Image', 'Label' => 'Bootstrapper\Facades\Label', 'MediaObject' => 'Bootstrapper\Facades\MediaObject', 'Modal' => 'Bootstrapper\Facades\Modal', 'Navbar' => 'Bootstrapper\Facades\Navbar', 'Navigation' => 'Bootstrapper\Facades\Navigation', 'Panel' => 'Bootstrapper\Facades\Panel', 'ProgressBar' => 'Bootstrapper\Facades\ProgressBar', 'Tabbable' => 'Bootstrapper\Facades\Tabbable', 'Table' => 'Bootstrapper\Facades\Table', 'Thumbnail' => 'Bootstrapper\Facades\Thumbnail',
Secondly, attributes are now passed in using the withAttributes()
chained method.
Finally, all objects that need to be turned into a string will now fail gracefully if an exception is thrown during render. This will print out the following string
An exception of type $class
was thrown with the message: $message
If you wish to override this behaviour, call the render()
method on the object
explicitly.
create()
method has now been removed in favour of the more
descriptive named()
method.
AccordionException
if the accordion is
not named using the named()
method.
withContents()
now expects you to be explicit with your array keys.
Instead of using withContents([['First', 'Content'], ['Second', 'Content']])
,
use withContents([['title' => 'First', 'contents' => 'Content']])
withContents()
no longer accepts a second parameter to default open
the accordion. This should be done with the open()
0
, instead of 1
.
open()
method - that is, that if you want the
closing × to be generated for you, you now must use the chainable close()
method.
block()
method has now been removed (since .alert-block
was removed in
Bootstrap 3).
normal()
method has been renamed to withContents()
create()
method has been removed and renamed withLinks()
lg_primary('content')
should
now be primary('content')->large()
.
lg()
, sm()
and xs()
functions have been extended
to their full names (large()
, small()
, extraSmall()
respectively).
link()
function now creates a button with class .btn-link
. To create an
<a>
tag, use the asLinkTo()
function.
create()
has been renamed withContents()
.
withContents()
no longer expects an array of arrays, instead expecting
an array of string-like objects (usually a Button
object).
<div class="btn-toolbar" role="toolbar"> ... </div>
create()
method has been renamed withContents()
named()
method. Failure to
do so will throw a Bootstrapper\Exceptions\CarouselException
.
withContents()
should use the keys
image
, caption
and alt
.
lg_primary()
should
now be primary()->large()
.
lg()
, sm()
and xs()
functions have been extended
to their full names (large()
, small()
, extraSmall()
respectively).
primary()
, danger()
, warning()
,
success()
, info()
and normal()
no longer accept 3 arguments. Use withContents()
and
withAttributes()
.
*_open()
methods have been removed.
*_open_for_files()
, *_open_secure()
,
*_open_secure_for_files()
have been removed. Use the standard
Laravel methods for secure or file forms.
horizontal_model()
etc have been renamed horizontalModel
.
*_append_with_button
etc have been removed. Use the InputGroup
class instead.
Bootstrapper\Helpers::get_CSS()
should be replaced with Helpers::css()
.
Bootstrapper\Helpers::get_JS()
should be replaced with Helpers::js()
.
create()
has been renamed withContents()
and expects
an array of arrays.
withContents()
instead.
open_list()
and close_list()
have been removed. Use
the asList()
chained method instead.
create()
has been removed.
Navbar::create()
call now takes parameters in the opposite order (giving
Navbar::create($position, $attributes = [])
. Previous calls such as
Navbar::create(['role' => 'navigation'], Navbar::FIX_TOP)
should now be
Navbar::create(Navbar::FIX_TOP, ['role' => 'navigation'])
Navbar::inverse()
now has the signature Navbar::inverse($position,
$attributes)
with_brand()
has been renamed withBrand()
.
with_menus()
has been renamed withContent()
.
withContent()
now expects either a Navigation
object or a string. It can
survive being given any other object, as long as it has a __toString()
implementation.
Navigation::links()
has been removed. Use pills()
or tabs()
pills()
and tabs()
now only expect an array argument, instead of the return value
of Navigation::links
.
pills()
or tabs()
method
signatures to make the result stacked. Instead, use the chained method stacked()
.
pills()
or tabs()
must be explicit.
Instead of using ['Home', url('home')]
, you must use
['title' => 'Home', 'link' => url('home')
.
Support for the older shorthand method may return, depending on requests. If you feel it
important, please open an issue.
This class has now been removed. Use the standard Laravel paginator instead.
header()
, body()
, footer()
have been
renamed withHeader()
etc
This class has now been renamed to ProgressBar
from Progress
.
Progress::normal_striped(20)
should now be ProgressBar::normal(20)->striped()
open()
and close()
have been removed.
open()
method.
headers()
has been removed.
body()
has been renamed withContents()
.
always_ignore()
has been removed.
callback()
function.
This class has now been removed. Use the standard Bootstrap classes for the relevant tags.
You used to be able to size your input fields by making your standard call with span*_
in front of the function name.
Bootstrap 3 now requires field sizing to be done by wrapping them inside a .col-xs-*
instead.
Form::span1_text('t_span1', 'span1') Form::span2_text('t_span2', 'span2') Form::span3_text('t_span3', 'span3') Form::span1_select('s_span1', array('1', '2', '3', '4', '5')) Form::span2_select('s_span2', array('1', '2', '3', '4', '5')) Form::span3_select('s_span3', array('1', '2', '3', '4', '5'))
<div class='col-xs-1'> Form::text('t_span1', 'span1') </div> <div class='col-xs-2'> Form::text('t_span2', 'span2') </div> <div class='col-xs-3'> Form::text('t_span3', 'span3') </div> <div class='col-xs-1'> Form::select('s_span1', array('1', '2', '3', '4', '5')) </div> <div class='col-xs-2'> Form::select('s_span2', array('1', '2', '3', '4', '5')) </div> <div class='col-xs-3'> Form::select('s_span3', array('1', '2', '3', '4', '5')) </div>
Button Groups have now changed completely from before - instead of
calling
ButtonGroup::open(ButtonGroup::TOGGLE_CHECKBOX)
,
Button::primary('foo')
and
ButtonGroup::close()
,
now you call
ButtonGroup::checkbox(array(array(ButtonGroup::PRIMARY, 'foo')))
//Checkbox ButtonGroup::open(ButtonGroup::TOGGLE_CHECKBOX) Button::danger_normal('Left') Button::danger_normal('Middle') Button::danger_normal('Right') ButtonGroup::close() //Radio ButtonGroup::open(ButtonGroup::TOGGLE_RADIO) Button::primary_normal('Left') Button::primary_normal('Middle') Button::primary_normal('Right') ButtonGroup::close()
//Checkbox ButtonGroup::checkbox(array( array(ButtonGroup::DANGER, 'Left'), array(ButtonGroup::DANGER, 'Middle'), array(ButtonGroup::DANGER, 'Right') )) //Radio ButtonGroup::radio(array( array(ButtonGroup::PRIMARY, 'Left'), array(ButtonGroup::PRIMARY, 'Middle'), array(ButtonGroup::PRIMARY, 'Right') ))