Skip to content
PHP Ecosystem
Explore

TimePicker

API reference › TimePicker › TimePicker

Renders a Timepicker bound to a model attribute or a named input.

See also: https://github.com/rendom/bootstrap-3-timepicker, https://github.com/jdewit/bootstrap-timepicker.

PropertyTypeDescriptionDefined by
$addonstring|false|nullTrusted HTML for the addon, false to render no addon, or null for the Bootstrap version’s clock icon. Default: null.TimePicker
$addonOptionsarray<string, mixed>Addon attributes, including optional asButton and buttonOptions. Default: [].TimePicker
$attributestring|nullThe model attribute that this widget is associated with. Default: null.yii\widgets\InputWidget
$autoIdPrefix staticstringThe prefix to the automatically generated widget IDs. Default: 'w'.yii\base\Widget
$behaviors read-onlyarray<yii\base\Behavior<static>>List of behaviors attached to this component.yii\base\Component
$bsVersionint|string|nullBootstrap major version or dotted version; defaults to the application setting or Bootstrap 3. Default: null.TimePicker
$containerOptionsarray<array-key, mixed>Outer wrapper attributes. Default: [].TimePicker
$defaultOptionsarray<string, mixed>Defaults merged before the supplied HTML attributes. Default: [].TimePicker
$defaultPluginOptionsarray<string, mixed>Defaults merged before the supplied plugin options. Default: [].TimePicker
$disabledboolSets the disabled HTML attribute unless options already specifies it. Default: false.TimePicker
$fieldyii\widgets\ActiveFieldActive input field, which triggers this widget rendering. Default: null. Available since 2.0.11.yii\widgets\InputWidget
$hashVarLoadPositionintYii view position for the JavaScript option variable. Default: \yii\web\View::POS_HEAD.TimePicker
$idstringId of the widget.yii\base\Widget
$languagestring|nullLanguage passed to Yii message translation for the popup opener. Default: null.TimePicker
$modelyii\base\Model|nullThe data model that this widget is associated with. Default: null.yii\widgets\InputWidget
$namestring|nullThe input name. Default: null.yii\widgets\InputWidget
$optionsarrayThe HTML attributes for the input tag. Default: [].yii\widgets\InputWidget
$pjaxContainerIdstring|nullOptional PJAX container ID used to reinitialize replaced fields. Default: null.TimePicker
$pluginEventsarray<string, string|yii\web\JsExpression>JavaScript callbacks keyed by jQuery event name. Default: [].TimePicker
$pluginOptionsarray<string, mixed>|falseJavaScript options, or false to keep a plain input. Default: [].TimePicker
$readonlyboolSets the readonly HTML attribute unless options already specifies it. Default: false.TimePicker
$sizestring|nullBootstrap input sizing suffix. Default: null.TimePicker
$valuestringThe input value. Default: null.yii\widgets\InputWidget
$viewyii\web\ViewThe view object that can be used to render views or view files.yii\base\Widget
$viewPath read-onlystringThe directory containing the view files for this widget.yii\base\Widget
MethodDescriptionDefined by
__construct()Constructor.yii\base\BaseObject
__call()Calls the named method which is not a class method.yii\base\Component
__clone()This method is called after the object is created by cloning an existing one.yii\base\Component
__get()Returns the value of a component property.yii\base\Component
__isset()Checks if a property is set, i.e. defined and not null.yii\base\Component
__set()Sets the value of a component property.yii\base\Component
__unset()Sets a component property to be null.yii\base\Component
afterRun()This method is invoked right after a widget is executed.yii\base\Widget
attachBehavior()Attaches a behavior to this component.yii\base\Component
attachBehaviors()Attaches a list of behaviors to the component.yii\base\Component
beforeRun()This method is invoked right before the widget is executed.yii\base\Widget
begin() staticBegins a widget.yii\base\Widget
behaviors()Returns a list of behaviors that this component should behave as.yii\base\Component
canGetProperty()Returns a value indicating whether a property can be read.yii\base\Component
canSetProperty()Returns a value indicating whether a property can be set.yii\base\Component
className() staticReturns the fully qualified name of this class.yii\base\BaseObject
detachBehavior()Detaches a behavior from the component.yii\base\Component
detachBehaviors()Detaches all behaviors from the component.yii\base\Component
end() staticEnds a widget.yii\base\Widget
ensureBehaviors()Makes sure that the behaviors declared in behaviors() are attached to this component.yii\base\Component
getBehavior()Returns the named behavior object.yii\base\Component
getBehaviors()Returns all behaviors attached to this component.yii\base\Component
getId()Returns the ID of the widget.yii\base\Widget
getView()Returns the view object that can be used to render views or view files.yii\base\Widget
getViewPath()Returns the directory containing the view files for this widget.yii\base\Widget
hasEventHandlers()Returns a value indicating whether there is any handler attached to the named event.yii\base\Component
hasMethod()Returns a value indicating whether a method is defined.yii\base\Component
hasProperty()Returns a value indicating whether a property is defined for this component.yii\base\Component
init()Merges input defaults and resolves the Bootstrap major version.TimePicker
off()Detaches an existing event handler from this component.yii\base\Component
on()Attaches an event handler to an event.yii\base\Component
registerAssets()Registers the local assets and the initial options used by the jQuery and DynamicForm entry points.TimePicker
render()Renders a view.yii\base\Widget
renderFile()Renders a view file.yii\base\Widget
run()Registers the assets and renders the time picker or a plain text input.TimePicker
setId()Sets the ID of the widget.yii\base\Widget
setView()Sets the view object to be used by this widget.yii\base\Widget
trigger()Triggers an event.yii\base\Component
widget() staticCreates a widget instance and runs it.yii\base\Widget
hasModel() protectedyii\widgets\InputWidget
renderInput() protectedRenders the Bootstrap version’s input group and addon.TimePicker
renderInputHtml() protectedRender a HTML input tag.yii\widgets\InputWidget
EventTypeDescriptionDefined by
EVENT_INITyii\base\EventAn event that is triggered when the widget is initialized via init(). Event name: 'init'. Available since 2.0.11.yii\base\Widget
EVENT_BEFORE_RUNyii\base\WidgetEventAn event raised right before executing a widget. Event name: 'beforeRun'. Available since 2.0.11.yii\base\Widget
EVENT_AFTER_RUNyii\base\WidgetEventAn event raised right after executing a widget. Event name: 'afterRun'. Available since 2.0.11.yii\base\Widget
public function init(): void

Merges input defaults and resolves the Bootstrap major version.

public function registerAssets(): void

Registers the local assets and the initial options used by the jQuery and DynamicForm entry points.

public function run(): string

Registers the assets and renders the time picker or a plain text input.

Returns

string

protected function renderInput(): string

Renders the Bootstrap version’s input group and addon.

Returns

string