FacturaScripts

WidgetInfo extends BaseWidget
in package

Widget informativo para mostrar textos, alertas Bootstrap 5, iconos y enlaces en formularios y vistas XMLView. No está vinculado a ningún campo del modelo.

Ejemplos de uso en XMLView:

Table of Contents

Constants

ALERT_BTN_CLASS  = ['primary' => 'btn-primary', 'secondary' => 'btn-secondary', 'success' => 'btn-success', 'danger' => 'btn-danger', 'warning' => 'btn-warning', 'info' => 'btn-info', 'light' => 'btn-secondary', 'dark' => 'btn-light']
Clase de botón recomendada según la documentación de Bootstrap 5 para cada tipo de alerta.
ALERT_TYPES  = ['primary', 'secondary', 'success', 'danger', 'warning', 'info', 'light', 'dark']

Properties

$autocomplete  : bool
$class  : string
$fieldclick  : mixed
$fieldname  : string
$icon  : string
$id  : string
Identifies the object with a defined name in the view
$name  : string
Name defined in the view as key
$onclick  : string
$options  : array<string|int, mixed>
$readonly  : string
$required  : bool
$tabindex  : int
$alert  : string
$btnClass  : string
$btnText  : string
$href  : string
$template  : string
$text  : string
$uniqueId  : int
$value  : mixed
$valueOnClick  : mixed

Methods

__construct()  : mixed
edit()  : string
Renderiza el widget en modo edición (formulario).
getColorFromOption()  : string
Calculate color from option configuration
getLevel()  : int
getToken()  : string
getType()  : string
Get the widget type
gridFormat()  : array<string|int, mixed>
inputHidden()  : string
No genera input oculto (el widget no tiene campo de modelo).
plainText()  : string
Muestra el texto traducido en texto plano.
processFormData()  : void
No procesa datos de formulario (widget de solo visualización).
setCustomValue()  : mixed
Set custom fixed value to widget
setLevel()  : mixed
setToken()  : mixed
showTableTotals()  : bool
tableCell()  : string
Renderiza el widget en la celda de una tabla.
applyOperatorFromOption()  : bool
assets()  : mixed
Adds assets to the asset manager.
buildAlertHtml()  : string
Construye el HTML de una alerta Bootstrap 5.
buildContent()  : string
Construye el HTML completo del contenido del widget.
buildLinkHtml()  : string
Construye el HTML del botón de enlace.
buildPlainHtml()  : string
Construye el HTML sin alerta (texto simple con icono y enlace opcionales).
colorToClass()  : string
combineClasses()  : string
css()  : string
Returns equivalent css class to $class. To extend in plugins.
getUniqueId()  : int
inputHtml()  : string
inputHtmlExtraParams()  : string
loadOptions()  : void
onclickHtml()  : string
readonly()  : bool
renderTemplate()  : string
Renderiza una vista Twig personalizada pasando el modelo como variable.
setValue()  : void
Sin campo de modelo vinculado, no hay valor que establecer.
show()  : string
tableCellClass()  : string
getSafeHref()  : string
Devuelve un href seguro para renderizar o cadena vacía si no es válido.

Constants

ALERT_BTN_CLASS

Clase de botón recomendada según la documentación de Bootstrap 5 para cada tipo de alerta.

public array<string|int, string> ALERT_BTN_CLASS = ['primary' => 'btn-primary', 'secondary' => 'btn-secondary', 'success' => 'btn-success', 'danger' => 'btn-danger', 'warning' => 'btn-warning', 'info' => 'btn-info', 'light' => 'btn-secondary', 'dark' => 'btn-light']

ALERT_TYPES

public array<string|int, string> ALERT_TYPES = ['primary', 'secondary', 'success', 'danger', 'warning', 'info', 'light', 'dark']

Tipos de alerta Bootstrap 5 válidos

Properties

$id

Identifies the object with a defined name in the view

public string $id

$name

Name defined in the view as key

public string $name

$options

public array<string|int, mixed> $options = []

$alert

protected string $alert

Tipo de alerta Bootstrap 5

$btnClass

protected string $btnClass

Clase CSS del botón de enlace

$btnText

protected string $btnText

Texto del botón de enlace (traducible)

$template

protected string $template

Ruta a una vista Twig personalizada (sin extensión .html.twig)

$text

protected string $text

Texto informativo principal (traducible con Tools::trans())

$valueOnClick

protected mixed $valueOnClick = null

Methods

__construct()

public __construct(array<string|int, mixed> $data) : mixed
Parameters
$data : array<string|int, mixed>

edit()

Renderiza el widget en modo edición (formulario).

public edit(object $model[, string $title = '' ][, string $description = '' ][, string $titleurl = '' ]) : string
Parameters
$model : object
$title : string = ''
$description : string = ''
$titleurl : string = ''
Return values
string

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
string

getLevel()

public static getLevel() : int
Return values
int

getToken()

public static getToken() : string
Return values
string

getType()

Get the widget type

public getType() : string
Return values
string

gridFormat()

public gridFormat() : array<string|int, mixed>
Return values
array<string|int, mixed>

inputHidden()

No genera input oculto (el widget no tiene campo de modelo).

public inputHidden(object $model) : string
Parameters
$model : object
Return values
string

plainText()

Muestra el texto traducido en texto plano.

public plainText(object $model) : string
Parameters
$model : object
Return values
string

processFormData()

No procesa datos de formulario (widget de solo visualización).

public processFormData(object &$model, Request $request) : void
Parameters
$model : object
$request : Request

setCustomValue()

Set custom fixed value to widget

public setCustomValue(mixed $value) : mixed
Parameters
$value : mixed

setLevel()

public static setLevel(int $new) : mixed
Parameters
$new : int

setToken()

public static setToken(string $token) : mixed
Parameters
$token : string

showTableTotals()

public showTableTotals() : bool
Return values
bool

tableCell()

Renderiza el widget en la celda de una tabla.

public tableCell(object $model[, string $display = 'left' ]) : string
Parameters
$model : object
$display : string = 'left'
Return values
string

applyOperatorFromOption()

protected applyOperatorFromOption(array<string|int, string> $option, mixed $value) : bool
Parameters
$option : array<string|int, string>
$value : mixed
Return values
bool

assets()

Adds assets to the asset manager.

protected assets() : mixed

buildAlertHtml()

Construye el HTML de una alerta Bootstrap 5.

protected buildAlertHtml(string $iconHtml, string $text, string $linkHtml) : string
Parameters
$iconHtml : string
$text : string
$linkHtml : string
Return values
string

buildContent()

Construye el HTML completo del contenido del widget.

protected buildContent() : string
Return values
string

buildLinkHtml()

Construye el HTML del botón de enlace.

protected buildLinkHtml() : string
Return values
string

buildPlainHtml()

Construye el HTML sin alerta (texto simple con icono y enlace opcionales).

protected buildPlainHtml(string $iconHtml, string $text, string $linkHtml) : string
Parameters
$iconHtml : string
$text : string
$linkHtml : string
Return values
string

colorToClass()

protected colorToClass(string $color, string $prefix) : string
Parameters
$color : string
$prefix : string
Return values
string

combineClasses()

protected combineClasses(array<string|int, mixed> ...$classes) : string
Parameters
$classes : array<string|int, mixed>
Return values
string

css()

Returns equivalent css class to $class. To extend in plugins.

protected css(string $class) : string
Parameters
$class : string
Return values
string

getUniqueId()

protected getUniqueId() : int
Return values
int

inputHtml()

protected inputHtml([string $type = 'text' ][, string $extraClass = '' ]) : string
Parameters
$type : string = 'text'
$extraClass : string = ''
Return values
string

inputHtmlExtraParams()

protected inputHtmlExtraParams() : string
Return values
string

loadOptions()

protected loadOptions(array<string|int, mixed> $children) : void
Parameters
$children : array<string|int, mixed>

onclickHtml()

protected onclickHtml(string $inside[, string $titleurl = '' ]) : string
Parameters
$inside : string
$titleurl : string = ''
Return values
string

readonly()

protected readonly() : bool
Return values
bool

renderTemplate()

Renderiza una vista Twig personalizada pasando el modelo como variable.

protected renderTemplate(object $model) : string
Parameters
$model : object
Return values
string

setValue()

Sin campo de modelo vinculado, no hay valor que establecer.

protected setValue(object $model) : void
Parameters
$model : object

show()

protected show() : string
Return values
string

tableCellClass()

protected tableCellClass([string $initialClass = '' ][, string $alternativeClass = '' ]) : string
Parameters
$initialClass : string = ''
$alternativeClass : string = ''
Return values
string

getSafeHref()

Devuelve un href seguro para renderizar o cadena vacía si no es válido.

private getSafeHref() : string

Se permiten únicamente URLs absolutas http/https y rutas relativas habituales de la aplicación.

Return values
string

        
On this page

Search results