-
Notifications
You must be signed in to change notification settings - Fork 1
Documentation
In the header section of php class, use the O2System Bootstrap's component as follows:
use O2System\Bootstrap\Components\{{component}};
Replace
{{component}}
with O2System Bootstrap Component's Class Name.
use O2System\Bootstrap\Components\Header;
Inside of the method's block, create new O2System Bootstrap Factory's component instance.
$variable = new {{component}}();
$myButton = new Header();
Here are a set of components could be used in class instantiate. For detail description of each components, please see the component's list section or click one of the component below:
Component's Name | Component's Name | Component's Name |
---|---|---|
Alert | Article | Badge |
Breadcrumb | Button | Calendar |
Carousel | Dropdown | Embed |
Fieldset | Form | Grid |
Group | Header | HTML |
Image | Input | Jumbotron |
Label | Link | Lists |
Media | Modal | Nav |
Navbar | Pager | Pagination |
Panel | Progress | Slide |
Table | Tabs | Tag |
Thumbnail | Toolbar | Well |
All components declared would be rendered by its default attributes. To modify the component, O2System Bootstrap Factory uses some methods attached to the declared component's instance.
// Declare header instance
$myHeader = new Header();
// Modify its title and subtext
$myHeader->setTitle('My Header');
$myHeader->setSubtext( 'My Header Subtext' );
Please refer to available built in methods list for each components used.
O2System Bootstrap Factory has four kinds of alert; success, info, warning, and danger.
$alert = new Alert($content, $type);
Variable | Type | Requirement | Description |
---|---|---|---|
$content |
string |
Required | the text content of the alert |
$type |
string |
Required |
the alert type, valid values are: "danger" , "info" , "success" , and "warning" ,
|
<?php
use O2System\Bootstrap\Components\Alert;
...
$alertSuccess = new Alert('This is an example of success alert', 'success');
...
This component could be manipulated using built in methods created in the class.
<?php
use O2System\Bootstrap\Components\Alert;
...
$alertSuccess = new Alert('This is an example of success alert', 'success');
//set a title using setTitle() method
$alertSuccess->setTitle('This is a title', 'h2');
...
Below is a set of method could be used to manipulate the basic usage of this component:
Method's Name | Parameter | Param. Requirement | Description |
---|---|---|---|
__clone() |
- | - | to duplicate current allert with current configurations |
isDismissible() |
- | - | to check if the alert is dismissable |
setTitle($title) |
string $title |
Required | to set alert's title |
Not yet available for current stable release
Badge is numerical indicators of how many items are associated with a link.
It is used to easily highlight new or unread items by adding a <span class="badge">
to some other components.
$alert = new Badge($count, $component);
Variable | Type | Requirement | Description |
---|---|---|---|
$count |
integer |
Required | the number wants to be displayed in the badge |
$component |
object |
Required | the component where the badge is appeared |
<?php
use O2System\Bootstrap\Components\Alert;
use O2System\Bootstrap\Components\Link;
...
//create a badge for a link
$badge = new Badge(40, Link( 'My Link', 'http://myurl.com' ));
...
This component could be manipulated using built in methods created in the class.
<?php
use O2System\Bootstrap\Components\Alert;
use O2System\Bootstrap\Components\Link;
...
$badge = new Badge(30, Link('My Link', '#'));
// set badge value which will update the badge's count to 20
$badge->setValue(20);
...
Below is a set of method could be used to manipulate the basic usage of this component:
Method's Name | Parameter | Param. Requirement | Description |
---|---|---|---|
setValue($count) |
integer $count |
Required | to set value of the badge |
setContainer($component) |
string $component |
Required | to set a component to where the badge should appear |
Breadcrumb indicates the current page's location within a navigational hierarchy.
use O2System\Bootstrap\Components\Breadcrumbs;
...
$breadcrumbs = new Breadcrumbs();
...
Generating a bootstrap styled button.
use O2System\Bootstrap\Components\Button;
...
$button = new Button();
...
Not yet available for current stable release
Carousel class is a class to create a component for cycling through elements, like a carousel (slideshow).
use O2System\Bootstrap\Components\Carousel;
...
$carousel = new Carousel();
...
A dropdown is a menu which is toggleable that allows the user to choose one value from a predefined list.
use O2System\Bootstrap\Components\Dropdown;
...
$dropdown = new Dropdown();
...
Embed is a class which make it possible for browsers to determine video or slideshow dimensions based on the width of their containing block by creating an intrinsic ratio that will properly scale on any device.
use O2System\Bootstrap\Components\Embed;
...
$embed = new Embed();
...
Fieldset is used to group related elements in a form and draws a box around the related elements.
use O2System\Bootstrap\Components\Fieldset;
...
$fieldset = new Fieldset();
...
Form is a component that allows a user to enter data that is sent to a server for processing.
use O2System\Bootstrap\Components\Form;
...
$form = new Form();
...
Grid is used for creating page layouts through a series of rows and columns that house the content.
use O2System\Bootstrap\Components\Grid;
...
$grid = new Grid();
...
Group is a component which collect a series of other components all together into a div block.
use O2System\Bootstrap\Components\Group;
...
$group = new Group();
...
Header is A simple shell for an h1 to appropriately space out and segment sections of content on a page.
use O2System\Bootstrap\Components\Header;
...
$header = new Header();
...
Not yet available for current stable release
Image is a component to wrap an image file.
use O2System\Bootstrap\Components\Image;
...
$image = new Image();
...
Input is a text field where user could insert short occurrence of text to be processed within a form.
use O2System\Bootstrap\Components\Input;
...
$input = new Input();
...
Jumbotron is a lightweight, flexible component that can optionally extend the entire viewport to showcase key content of a site.
use O2System\Bootstrap\Components\Jumbotron;
...
$jumbotron = new Jumbotron();
...
Label is a text component which explains an text field component, for example input or textarea, but not limited to be used with other components.
use O2System\Bootstrap\Components\Label;
...
$label = new Label();
...
Link is a hyperlinks which could be clicked to jump to another document or point of anchor within the same document.
use O2System\Bootstrap\Components\Link;
...
$link = new Link();
...
List is a component that wrapped items into an ordered or unordered list.
use O2System\Bootstrap\Components\Lists;
...
$lists = new Lists();
...
Media component is an abstract element used as the basis for building more complex and repetitive media objects (like video, music, etc).
use O2System\Bootstrap\Components\Media;
...
$media = new Media();
...
Not yet available for current stable release.
Navs available in Bootstrap have shared markup, starting with the base .nav class, as well as shared states.
use O2System\Bootstrap\Components\Nav;
...
$nav = new Nav();
...
Navbar is a navigation header that is placed at the top of the page.
use O2System\Bootstrap\Components\Navbar;
...
$navbar = new Navbar();
...
Pager is a form of pagination and provides previous and next buttons but has more advanced features than Pagination component.
use O2System\Bootstrap\Components\Pager;
...
$pager = new Pager();
...
Pagination provides pagination links for a site or app with the multi-page pagination component, or the simpler Pager alternative.
use O2System\Bootstrap\Components\Pagination;
...
$pagination = new Pagination();
...
Panel is a boxed component consists of header, body and footer section. Panel is useful to put components into a box which is easy to be read.
use O2System\Bootstrap\Components\Panel;
...
$panel = new Panel();
...
Progress provides up-to-date feedback on the progress of a workflow or action with simple yet flexible bars.
use O2System\Bootstrap\Components\Progress;
...
$progress = new Progress();
...
Slide provides more advanced functionality than what Carousel component has. Decription, caption, link, and content might be modified based on the need.
use O2System\Bootstrap\Components\Slide;
...
$slide = new Slide();
...
Class Table provides bootstrap styled table.
use O2System\Bootstrap\Components\Table;
...
$table = new Table();
...
Tabs is a small flap or strip of material attached to or projecting from something, used to hold or manipulate it, or for identification and information.
use O2System\Bootstrap\Components\Tabs;
...
$tabs = new Tabs();
...
Tag provides most of HTML tags available to be used with the other components. Attributes might be inserted as well.
use O2System\Bootstrap\Components\Tag;
...
$tag = new Tag();
...
Thumbnail is a smaller sized image previewing the real sized image.
use O2System\Bootstrap\Components\Thumbnail;
...
$thumbnail = new Thumbnail();
...
Toolbar combines set of button group into button toolbar for more complex component.
use O2System\Bootstrap\Components\Toolbar;
...
$toolbar = new Toolbar();
...
Well component gives a simple effect on an element with an inset effect.
use O2System\Bootstrap\Components\Well;
...
$well = new Well();
...
Besides the usage of basic method listed above, the components could be modified using the methods provided in the Interface classes listed below.
The interface has already been declared inside every component's class based on the need. Not every interface class is loaded. Therefore the usage of interface method must apply to what interface class declared in the component's class.
<?php
// import the needed class
use O2System\Bootstrap\Components\Header;
class Example
{
// instantiate the component
$header = new Header();
// use the method taken from the FactoryInterface
// which already declared in the Header component's class
$header->getAttributes();
...
}
Below is the interface available for the current stable release:
This Class is used by this Component class:
Group, Label, Link, Lists, Tag, and Toolbar.
Method | Parameters | Description |
---|---|---|
alignLeft() |
- | to make the left alignment type to the paragraph |
alignRight() |
- | to make the right alignment type to the paragraph |
pullLeft() |
- | to pull the text block to the left |
pullRight() |
- | * to pull the text block to the right* |
setPullClassPrefix($prefix) |
$prefix string:enum["left","right"] required |
to define the prefix to be used with the pull type of the text block |
textCenter() |
- | *to add attribute class *text-center to the tag
|
textJustify() |
- | *to add attribute class *text-justify to the tag
|
textLeft() |
- | *to add attribute class *text-left to the tag
|
textRight() |
- | *to add attribute class *text-right to the tag
|
This Class is used by this Component class:
Alert, HTML, Navbar, Panel, Tag, and Well.
Method | Parameters | Description |
---|---|---|
prependContent($content) |
$content string required |
to append the content provided in the parameter for the component |
prependContent($content) |
$content string required |
to prepend the content provided in the parameter for the component |
resetContent() |
- | to clear the current content set for the component |
setContent($content) |
$content string required |
to set the content provided in the parameter for the component |
This Class is used by this Component class:
Alert, Button, Label, Panel, and Progress.
Method | Parameters | Description |
---|---|---|
isDanger() |
- |
to check if current context used in the component is danger
|
isDefault() |
- |
to check if current context used in the component is default
|
isInfo() |
- |
to check if current context used in the component is info
|
isPrimary() |
- |
to check if current context used in the component is primary
|
isSuccess() |
- |
to check if current context used in the component is success
|
isWarning() |
- |
to check if current context used in the component is warning
|
setContextualClassPrefix($prefix) |
$prefix string:enum["left","right"] required |
to define the prefix to be used with the contextual class |
This Class is used by this Component class:
Alert, Badge, Button, Carousel, Embed, Form, Grid, Group, Header, HTML, Image, Input, Jumbotron, Label, Lists, Media, Navbar, Pager, Panel, Progress, Slide, Table, Tabs, Tag, Thumbnail, Toolbar, and Well.
Method | Parameters | Description |
---|---|---|
addAttribute($attr, $value) |
$attr string attribute name, required $value string attribute value, required |
to add attributes to be used by a component |
addAttributes($attrs) |
$attrs array required |
to add attributes to be used by a component |
addClasses($classes) |
$classes array required |
to add class names to be used by a component |
getAttribute($attr) |
$attr string attribute name, required |
to get all class names used by a component |
getAttributes() |
- | to get all attributes used by a component |
getClass() |
- | to get all class names used by a component |
hasAttribute($attr) |
$attr string required |
to check if current component has an attribute defined in the parameter given |
removeAttribute($attr) |
$attr string attribute name, required |
to remove single attribute used by a component |
removeAttributes($attrs) |
$attrs array attribute names, required |
to add attributes to be used by a component |
removeClass($class) |
$class string required comma delimiter |
to remove class name used by a component |
removeClasses($classes) |
$classes array required |
to remove class names used by a component |
setClass($class) |
$class string required comma delimiter |
to set the class name to be used by a component |
This Class is used by this Component class:
Method | Parameters | Description |
---|---|---|
setIcon($class) |
$icon object required |
to set an icon to be used by a component |
This Class is used by this Component class:
Carousel, Fieldset, Grid, Group, Lists, and Toolbar.
Method | Parameters | Description |
---|---|---|
addItems($items) |
$items array list's items, required |
to add items to be used by a List component |
addItem($item) |
$item object required |
to add an item to an existed List Component |
addLists($list) |
$list object required |
to add a Lists object to be used by a List component |
isEmpty() |
- | to check if a List component is currently has empty items |
setItemsMap($map) |
$map object required |
to set a map to be used by a List componnent |
setNumRows($rows) |
$rows integer required |
to set a number of rows to be used by a List componnent |
setNumPerRows($num) |
$num integer required |
to set a number of rows to be displayed in a List componnent |
This Class is used by this Component class:
Method | Parameters | Description |
---|---|---|
appendLabel($label) |
$label string required |
to append a label to currently existed label used by a componnent |
prependLabel($label) |
$label string required |
to prepend a label to currently existed label used by a componnent |
resetLabel() |
- | to reset the label which is currently used by a componnent |
setLabel($label) |
$label string required |
to set a label to be used by a componnent |
This Class is used by this Component class:
Alert, Badge, Group, Label, Lists, Tag, and Toolbar.
Method | Parameters | Description |
---|---|---|
isPrintHidden() |
- |
to add class attribute with value hidden-print to a component
|
isPrintVisible() |
- |
to add class attribute with value visible-print to a component
|
This Class is used by this Component class:
Badge, Group, Label, Link, Lists, Tag, and Toolbar.
Method | Parameters | Description |
---|---|---|
isLargeHidden() |
- |
to add class attribute with value hidden-lg to a component
|
isLargeVisible() |
- |
to add class attribute with value visible-lg to a component
|
isMediumHidden() |
- |
to add class attribute with value hidden-md to a component
|
isMediumVisible() |
- |
to add class attribute with value visible-md to a component
|
isSmallHidden() |
- |
to add class attribute with value hidden-sm to a component
|
isSmallVisible() |
- |
to add class attribute with value visible-sm to a component
|
isXsmallHidden() |
- |
to add class attribute with value hidden-xs to a component
|
isXsmallVisible() |
- |
to add class attribute with value visible-xs to a component
|
This Class is used by this Component class:
Button, Group, Label, Lists, and Well.
Method | Parameters | Description |
---|---|---|
isTiny() |
- |
to add class attribute with value prefix-xs to a component
|
isSmall() |
- |
to add class attribute with value prefix-sm to a component
|
isMedium() |
- |
to add class attribute with value prefix-md to a component
|
isLarge() |
- |
to add class attribute with value prefix-lg to a component
|
setSizeClasFactorysPrefix($prefix) |
$prefix string required |
to define the prefix to be used with the Size class |
This Class is used by this Component class:
Method | Parameters | Description |
---|---|---|
textCapitalize() |
- |
to add class attribute with value text-capitalize to a component
|
textDanger() |
- |
to add class attribute with value text-danger to a component
|
textLowerCase() |
- |
to add class attribute with value text-lowercase to a component
|
textMuted() |
- |
to add class attribute with value text-muted to a component
|
textPrimary() |
- |
to add class attribute with value text-primary to a component
|
textSmall() |
- |
to add class attribute with value text-small to a component
|
textSuccess() |
- |
to add class attribute with value text-success to a component
|
textUpperCase() |
- |
to add class attribute with value text-uppercase to a component
|
textWarning() |
- |
to add class attribute with value text-warning to a component
|