Skip to content

Instantly share code, notes, and snippets.

@svenl77
Last active October 12, 2016 21:05
Show Gist options
  • Save svenl77/610f4c6ee6e6ed01e117513a04ce4025 to your computer and use it in GitHub Desktop.
Save svenl77/610f4c6ee6e6ed01e117513a04ce4025 to your computer and use it in GitHub Desktop.
<?php
// Generates a hidden input element
Form::Hidden ("id", $attributes = null);
//Textbox
Form::Textbox ("Text", "text", $attributes = null);
// Number
Form::Number("Number", "Number", $attributes = null);
// Select
$options = Array ("1" => "option #1", "2" => "option #2");
Form::Select("Select", "select", $options, $attributes = null);
// Buttons
// Buttons have an extra parameter 'icon' to simplify icons markup. Currently fontawesome and glyphicon prefixes supported. Default markup for icons is span.
Form::Button ("Submit");
Form::Button ("Submit", "button");
Form::Button ("Submit", "button", ["class" => "btn-danger"]);
Form::Button ("Submit", "button", ["icon" => "glyphicon glyphicon-earphone"]);
Form::Button ("Submit", "button", ["icon" => "fa fa-chrome"]);
// Some options for the next examples
$options = Array ("1" => "option #1", "2" => "option #2");
// inline checkboxes
Form::Checkbox ("Inline", "food", $options, array("inline" => 1));
// regular checkboxes
Form::Checkbox ("Regular", "food2", $options, $attributes = null);
// Inline Radio
Form::Radio("Inline", "id", $options, array("inline" => 1));
Form::Radio("", "id2", $options, $attributes = null);
// Email
Form::Email ("Email Address", "email", $attributes = null);
// Password
Form::Password ("Password", "password", $attributes = null);
// File
Form::File("File", "file", $attributes = null);
// Textarea
Form::Textarea("Textarea", "textarea", $attributes = null);
// Phone
Form::Phone("Phone", "phone", $attributes = null);
// Search
Form::Search ("Search", "search", $attributes = null);
// URL
Form::Url("Url", "url");
// Date Elements
// Please note, that usage of date element can lead to a different behavoir in different browsers.
Form::Date("US Date", "date", $attributes = null);
Form::Date("EU Date", "date", array ("pattern" => "\d{2}.\d{2}.\d{4}",
"placeholder" => "DD.MM.YYYY"));
Form::DateTime("DateTime", "datetime", $attributes = null);
Form::DateTimeLocal("DateTime Local", "DateTimeLocal", $attributes = null);
Form::Month("Month", "month", $attributes = null);
Form::Week("Week", "week", $attributes = null);
Form::Time("Time", "time", $attributes = null);
// US Date
// dd/mm/yyyy
// EU Date
// dd/mm/yyyy
// DateTime
// DateTime Local
// dd/mm/yyyy, --:--
// Month
// Week
// Week --, ----
// Time --:--
// Calendar
// jQuery UI based calendar element. Extra option: jQueryOptions
Form::jQueryUIDate("Date", "jQueryUIDate", $attributes = null);
// Range
Form::Range("Range", "Range", $attributes = null);
// Color
Form::Color("Color", "Color", $attributes = null);
// State
Form::State("State", "State", $attributes = null);
// Country
Form::Country("Country", "Country", $attributes = null);
// Yes-No Question
Form::YesNo("Yes/No", "YesNo", $attributes = null);
// Captcha
Form::Captcha("Captcha", $attributes = null);
// Sort
Form::Sort("Sort", "Sort", $options, $attributes = null);
// Checksort
Form::Checksort("Checksort", "Checksort", $options, $attributes = null);
Form::Checksort("Checksort inline ", "Checksort", $options, array("inline" => 1));
//TinyMCE Editor
Form::TinyMCE("Article", "article", $attributes = null);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment