Class humhub\modules\ui\form\widgets\ColorPicker

Inheritancehumhub\modules\ui\form\widgets\ColorPicker » humhub\modules\ui\form\widgets\JsInputWidget » humhub\widgets\JsWidget » humhub\components\Widget » yii\base\Widget
Subclasseshumhub\widgets\ColorPickerField
Available since version1.3

Adds a color picker form field for the given model.

Public Methods

Hide inherited methods

MethodDescriptionDefined By
beforeRun() Initializes the widget. humhub\modules\ui\form\widgets\JsInputWidget
getId() Returns the html id of this widget, if no id is set this function will generate an id if $autoGenerate is set to true (default). humhub\widgets\JsWidget
init() humhub\modules\ui\form\widgets\ColorPicker
process() Process is a wrapper for the run method humhub\components\Widget
run() Default implementation of JsWidget. humhub\modules\ui\form\widgets\ColorPicker
setDefaultOptions() Sets some default data options required by all widgets as the widget implementation and the widget evetns and initialization trigger. humhub\widgets\JsWidget
widget() Creates a widget instance and runs it. humhub\components\Widget

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
getAttributes() Returns all html attributes for used by this widget and will normally inserted in the widgets root html element. humhub\widgets\JsWidget
getData() Returns an array of data-* attributes to configure your clientside js widget. humhub\widgets\JsWidget
getOptions() Assembles all widget attributes and data settings of this widget. humhub\widgets\JsWidget
getValue() humhub\modules\ui\form\widgets\JsInputWidget
hasModel() humhub\modules\ui\form\widgets\JsInputWidget

Events

Hide inherited events

EventTypeDescriptionDefined By
EVENT_CREATE humhub\libs\WidgetCreateEvent An event raised before creating a widget. humhub\components\Widget

Property Details

$attribute public property

The model attribute that this widget is associated with.

public string $attribute 'color'
$container public property

The container id used to append the actual color picker js widget.

public string $container null
$field public property
Deprecated since v1.2.2 use $attribute instead
public $field null
$randomDefault public property

If set to true, a random color will be set as default

public boolean $randomDefault true

Method Details

init() public method

public void init ( )
run() public method

Default implementation of JsWidget.

This will render a widget html element specified by $container and $content and the given $options/$event attributes. This function should be overwritten for widgets with a more complex rendering.

public string run ( )