WidgetDatalist
extends WidgetSelect
in package
Description of WidgetDatalist
Table of Contents
Properties
- $autocomplete : bool
- $class : string
- $fieldclick : string
- $fieldname : string
- $icon : string
- $id : string
- Identifies the object with a defined name in the view
- $multiple : bool
- $name : string
- Name defined in the view as key
- $onclick : string
- $options : array<string|int, mixed>
- $readonly : string
- $required : bool
- $tabindex : int
- $values : array<string|int, mixed>
- $codeModel : CodeModel
- $fieldcode : string
- $fieldfilter : string
- $fieldtitle : string
- $groupFieldcode : string
- $groupSource : string
- $groupTitle : string
- $limit : int
- $listId : string
- Id of the datalist shared by every row of the view.
- $parent : string
- $shared : bool
- $sharedListId : string|null
- $sharedListRendered : bool
- $source : string
- $translate : bool
- $uniqueId : int
- $value : mixed
- $valueOnClick : mixed
Methods
- __construct() : mixed
- edit() : string
- getColorFromOption() : string
- Calculate color from option configuration
- getDataSource() : array<string|int, mixed>
- Obtains the configuration of the datasource used in obtaining data
- getLevel() : int
- getToken() : string
- getType() : string
- Devuelve el tipo de widget.
- gridFormat() : array<string|int, mixed>
- inputHidden() : string
- plainText() : string
- processFormData() : mixed
- setCustomValue() : mixed
- Asigna un valor fijo personalizado al widget.
- setLevel() : mixed
- setToken() : mixed
- setValuesFromArray() : mixed
- Loads the value list from a given array.
- setValuesFromArrayKeys() : mixed
- setValuesFromCodeModel() : mixed
- setValuesFromRange() : mixed
- showTableTotals() : bool
- tableCell() : string
- applyOperatorFromOption() : bool
- assets() : void
- Añade los recursos necesarios al gestor de assets.
- colorToClass() : string
- combineClasses() : string
- css() : string
- Returns equivalent css class to $class. To extend in plugins.
- datalistHtml() : string
- Html of the datalist with every available option.
- escapeHtml() : string
- Normaliza entidades HTML existentes y escapa el valor para insertarlo en contexto HTML.
- getUniqueId() : int
- inputHtml() : string
- inputHtmlExtraParams() : string
- loadOptions() : void
- onclickHtml() : string
- readonly() : bool
- selectedOptionsHtml() : string
- Renders only the options needed to preserve the current value. The complete list is read by Select2 from the first select rendered by this widget.
- setSourceData() : mixed
- Set datasource data and Load data from Model into values array.
- setValue() : mixed
- show() : string
- tableCellClass() : string
Properties
$autocomplete
public
bool
$autocomplete
Indica si el navegador puede autocompletar el campo.
$class
public
string
$class
$fieldclick
public
string
$fieldclick
Campo alternativo usado para generar enlaces.
$fieldname
public
string
$fieldname
Nombre del campo del modelo asociado al widget.
$icon
public
string
$icon
Clase CSS del icono mostrado junto al widget.
$id
Identifies the object with a defined name in the view
public
string
$id
$multiple
public
bool
$multiple
$name
Name defined in the view as key
public
string
$name
$onclick
public
string
$onclick
Controlador o URL usado al hacer clic en el valor.
$options
public
array<string|int, mixed>
$options
= []
Opciones configuradas para el widget.
$readonly
public
string
$readonly
Modo de solo lectura del widget.
$required
public
bool
$required
Indica si el campo es obligatorio.
$tabindex
public
int
$tabindex
Orden de tabulación del campo.
$values
public
array<string|int, mixed>
$values
= []
$codeModel
protected
static CodeModel
$codeModel
$fieldcode
protected
string
$fieldcode
$fieldfilter
protected
string
$fieldfilter
$fieldtitle
protected
string
$fieldtitle
$groupFieldcode
protected
string
$groupFieldcode
= ''
$groupSource
protected
string
$groupSource
= ''
$groupTitle
protected
string
$groupTitle
= ''
$limit
protected
int
$limit
$listId
Id of the datalist shared by every row of the view.
protected
string
$listId
= null
$parent
protected
string
$parent
$shared
protected
bool
$shared
$sharedListId
protected
string|null
$sharedListId
= null
$sharedListRendered
protected
bool
$sharedListRendered
= false
$source
protected
string
$source
$translate
protected
bool
$translate
$uniqueId
protected
static int
$uniqueId
= -1
$value
protected
mixed
$value
Valor actual del widget.
$valueOnClick
protected
mixed
$valueOnClick
= null
Valor alternativo usado en el enlace del widget.
Methods
__construct()
public
__construct(array<string|int, mixed> $data) : mixed
Parameters
- $data : array<string|int, mixed>
-
Configuración del widget.
edit()
public
edit(object $model[, string $title = '' ][, string $description = '' ][, string $titleurl = '' ]) : string
Parameters
- $model : object
-
Modelo que contiene el valor del campo.
- $title : string = ''
-
Clave de traducción del título.
- $description : string = ''
-
Clave de traducción de la descripción.
- $titleurl : string = ''
-
URL opcional para enlazar el título.
Return values
string —HTML del widget en modo edición.
getColorFromOption()
Calculate color from option configuration
public
getColorFromOption(array<string|int, string> $option, mixed $value, string $prefix) : string
Parameters
- $option : array<string|int, string>
- $value : mixed
- $prefix : string
Return values
stringgetDataSource()
Obtains the configuration of the datasource used in obtaining data
public
getDataSource() : array<string|int, mixed>
Return values
array<string|int, mixed>getLevel()
public
static getLevel() : int
Return values
intgetToken()
public
static getToken() : string
Return values
stringgetType()
Devuelve el tipo de widget.
public
getType() : string
Return values
string —Tipo del widget.
gridFormat()
public
gridFormat() : array<string|int, mixed>
Return values
array<string|int, mixed> —Formato del widget para vistas en cuadrícula.
inputHidden()
public
inputHidden(object $model) : string
Parameters
- $model : object
-
Modelo que contiene el valor del campo.
Return values
string —Campo oculto con el valor actual.
plainText()
public
plainText(object $model) : string
Parameters
- $model : object
-
Modelo que contiene el valor del campo.
Return values
string —Representación en texto plano del valor.
processFormData()
public
processFormData(object &$model, Request $request) : mixed
Parameters
- $model : object
- $request : Request
setCustomValue()
Asigna un valor fijo personalizado al widget.
public
setCustomValue(mixed $value) : mixed
Parameters
- $value : mixed
-
Valor personalizado.
setLevel()
public
static setLevel(int $new) : mixed
Parameters
- $new : int
setToken()
public
static setToken(string $token) : mixed
Parameters
- $token : string
setValuesFromArray()
Loads the value list from a given array.
public
setValuesFromArray(array<string|int, mixed> $items[, bool $translate = false ][, bool $addEmpty = false ][, string $col1 = 'value' ][, string $col2 = 'title' ][, string $col3 = '' ]) : mixed
The array must have one of the two following structures:
- If it's a value array, it must use the value of each element as title and value
- If it's a multidimensional array, the indexes value and title must be set for each element
Parameters
- $items : array<string|int, mixed>
- $translate : bool = false
- $addEmpty : bool = false
- $col1 : string = 'value'
- $col2 : string = 'title'
- $col3 : string = ''
setValuesFromArrayKeys()
public
setValuesFromArrayKeys(array<string|int, mixed> $values[, bool $translate = false ][, bool $addEmpty = false ][, array<string|int, mixed> $groups = [] ]) : mixed
Parameters
- $values : array<string|int, mixed>
- $translate : bool = false
- $addEmpty : bool = false
- $groups : array<string|int, mixed> = []
setValuesFromCodeModel()
public
setValuesFromCodeModel(array<string|int, mixed> $rows[, bool $translate = false ][, array<string|int, mixed> $groups = [] ]) : mixed
Parameters
- $rows : array<string|int, mixed>
- $translate : bool = false
- $groups : array<string|int, mixed> = []
-
array indexado por code => etiqueta del grupo
setValuesFromRange()
public
setValuesFromRange(int $start, int $end, int $step[, array<string|int, mixed> $groups = [] ]) : mixed
Parameters
- $start : int
- $end : int
- $step : int
- $groups : array<string|int, mixed> = []
-
array indexado por valor numérico => etiqueta del grupo
showTableTotals()
public
showTableTotals() : bool
Return values
bool —Indica si el widget muestra totales en tablas.
tableCell()
public
tableCell(object $model[, string $display = 'left' ]) : string
Parameters
- $model : object
- $display : string = 'left'
Return values
stringapplyOperatorFromOption()
protected
applyOperatorFromOption(array<string|int, string> $option, mixed $value) : bool
Parameters
- $option : array<string|int, string>
- $value : mixed
Return values
boolassets()
Añade los recursos necesarios al gestor de assets.
protected
assets() : void
colorToClass()
protected
colorToClass(string $color, string $prefix) : string
Parameters
- $color : string
- $prefix : string
Return values
stringcombineClasses()
protected
combineClasses(array<string|int, mixed> ...$classes) : string
Parameters
- $classes : array<string|int, mixed>
Return values
stringcss()
Returns equivalent css class to $class. To extend in plugins.
protected
css(string $class) : string
Parameters
- $class : string
Return values
stringdatalistHtml()
Html of the datalist with every available option.
protected
datalistHtml() : string
Return values
stringescapeHtml()
Normaliza entidades HTML existentes y escapa el valor para insertarlo en contexto HTML.
protected
escapeHtml(mixed $value) : string
Parameters
- $value : mixed
-
Valor a escapar.
Return values
string —Valor escapado.
getUniqueId()
protected
getUniqueId() : int
Return values
intinputHtml()
protected
inputHtml([string $type = 'datalist' ][, string $extraClass = '' ]) : string
Parameters
- $type : string = 'datalist'
- $extraClass : string = ''
Return values
stringinputHtmlExtraParams()
protected
inputHtmlExtraParams() : string
Return values
stringloadOptions()
protected
loadOptions(array<string|int, mixed> $children) : void
Parameters
- $children : array<string|int, mixed>
-
Nodos hijos de configuración del widget.
onclickHtml()
protected
onclickHtml(string $inside[, string $titleurl = '' ]) : string
Parameters
- $inside : string
-
Contenido HTML del enlace.
- $titleurl : string = ''
-
URL alternativa para el título.
Return values
string —Contenido envuelto en enlace cuando corresponde.
readonly()
protected
readonly() : bool
Return values
bool —Indica si el widget está en modo solo lectura.
selectedOptionsHtml()
Renders only the options needed to preserve the current value. The complete list is read by Select2 from the first select rendered by this widget.
protected
selectedOptionsHtml() : string
Return values
stringsetSourceData()
Set datasource data and Load data from Model into values array.
protected
setSourceData(array<string|int, mixed> $child[, bool $loadData = true ]) : mixed
Parameters
- $child : array<string|int, mixed>
- $loadData : bool = true
setValue()
protected
setValue(object $model) : mixed
Parameters
- $model : object
-
Modelo que contiene el valor del campo.
show()
protected
show() : string
Return values
stringtableCellClass()
protected
tableCellClass([string $initialClass = '' ][, string $alternativeClass = '' ]) : string
Parameters
- $initialClass : string = ''
-
Clase CSS inicial.
- $alternativeClass : string = ''
-
Clase CSS alternativa.
Return values
string —Clases CSS de la celda.