SqlField
继承自 ListField支持自定义 SQL 选择列表
| 自 | 1.7.0 | 
|---|---|
| 包 | Joomla CMS | 
方法
__construct
用于实例化表单字段对象的方法。
__construct(\Joomla\CMS\Form\Form form = null) :
__get
用于从表单字段对象获取某些原本无法访问的属性的方法。
__get( name) :
| 自 | 3.2 | 
|---|
参数
- name
- string要获取其值的属性名称。
返回值
mixed属性值或 null。
__set
用于设置表单字段对象某些原本无法访问的属性的方法。
__set( name, value) :
| 自 | 3.2 | 
|---|
参数
- name
- string要设置其值的属性名称。
- value
- mixed属性的值。
返回值
void
addOption
用于向列表字段添加选项的方法。
addOption( text, string||string|int attributes = []) : \Joomla\CMS\Form\Field\ListField
| 自 | 3.7.0 | 
|---|
参数
- text
- string选项的文本/语言变量。
- attributes
- array<string|int, string>属性数组('name' => 'value' 格式)
返回值
ListField用于链式调用。
collectLayoutData
用于获取要传递到布局以进行渲染的数据的方法。
collectLayoutData() : mixed||string|int
数据缓存在内存中。
| 自 | 5.1.0 | 
|---|
返回值
array<string|int, mixed>
filter
用于过滤字段值的方法。
filter( value, group = null, \Joomla\Registry\Registry input = null) :
| 自 | 4.0.0 | 
|---|---|
| 抛出 | 
 | 
参数
- value
- mixed用作字段默认值的可选值。
- group
- string要查找字段的可选点分隔表单组路径。
- input
- Registry|null一个可选的 Registry 对象,其中包含要针对整个表单进行过滤的整个数据集。
返回值
mixed已过滤的值。
getAttribute
用于获取字段属性的方法
getAttribute( name, default = null) :
| 自 | 3.2 | 
|---|
参数
- name
- string要获取的属性名称
- default
- mixed如果未找到属性,则返回的可选值
返回值
mixed属性值/默认值
getCurrentUser
返回当前用户,如果未设置,则返回全局应用程序的身份。这将在 6.0 中更改,并将返回空用户。
getCurrentUser() : \Joomla\CMS\User\User
getDataAttributes
用于获取数据属性的方法。例如,data-user-type
getDataAttributes() : mixed||string|int
| 自 | 4.0.0 | 
|---|
返回值
array<string|int, mixed>数据属性列表
getFieldName
用于获取所用字段名称的方法。
getFieldName( fieldName) :
| 自 | 1.7.0 | 
|---|
参数
- fieldName
- string字段元素名称。
返回值
string字段名称
getId
用于获取用于字段输入标签的 id 的方法。
getId( fieldId, fieldName) :
| 自 | 1.7.0 | 
|---|
参数
- fieldId
- string字段元素 id。
- fieldName
- string字段元素名称。
返回值
string要用于字段输入标签的 id。
getInput
用于获取通用列表的字段输入标记的方法。
getInput() :
使用 multiple 属性启用多选。
| 自 | 3.7.0 | 
|---|
返回值
string字段输入标记。
getLabel
用于获取字段标签标记的方法。
getLabel() :
| 自 | 1.7.0 | 
|---|
返回值
string字段标签标记。
getLayoutData
用于获取要传递到布局以进行渲染的数据的方法。
getLayoutData() : mixed||string|int
| 自 | 3.5 | 
|---|
返回值
array<string|int, mixed>
getLayoutPaths
允许在子字段中覆盖渲染器包含路径
getLayoutPaths() : mixed||string|int
| 自 | 3.5 | 
|---|
返回值
array<string|int, mixed>
getName
用于获取用于字段输入标签的名称的方法。
getName( fieldName) :
| 自 | 1.7.0 | 
|---|
参数
- fieldName
- string字段元素名称。
返回值
string要用于字段输入标签的名称。
getOptions
用于获取自定义字段选项的方法。
getOptions() : object||string|int
使用 query 属性提供查询以生成列表。
| 自 | 1.7.0 | 
|---|
返回值
array<string|int, object>字段选项对象。
getRenderer
获取渲染器
getRenderer( layoutId = 'default') : \Joomla\CMS\Layout\FileLayout
getTitle
用于获取字段标题的方法。
getTitle() :
| 自 | 1.7.0 | 
|---|
返回值
string字段标题。
isDebugEnabled
此字段是否启用了调试
isDebugEnabled() :
| 自 | 3.5 | 
|---|
返回值
布尔值
postProcess
用于后处理字段值的方法。
postProcess( value, group = null, \Joomla\Registry\Registry input = null) :
| 自 | 4.0.0 | 
|---|
参数
- value
- mixed用作字段默认值的可选值。
- group
- string要查找字段的可选点分隔表单组路径。
- input
- Registry|null一个可选的 Registry 对象,其中包含要针对整个表单进行过滤的整个数据集。
返回值
mixed已处理的值。
processQuery
用于处理来自表单的查询的方法。
processQuery(string||string|int conditions, string||string|int filters, string||string|int defaults) : \Joomla\Database\QueryInterface
| 自 | 3.5 | 
|---|
参数
- conditions
- array<string|int, string>来自表单的条件。
- filters
- array<string|int, string>要过滤的列。
- defaults
- array<string|int, string>如果条件为空,则设置的默认值。
返回值
QueryInterface查询对象。
render
渲染此字段的布局
render( layoutId, mixed||string|int data = []) :
| 自 | 3.5 | 
|---|
参数
- layoutId
- string布局标识符
- data
- array<string|int, mixed>布局的可选数据
返回值
string
renderDataAttributes
用于将数据属性渲染为 HTML 的方法。
renderDataAttributes() :
| 自 | 4.0.0 | 
|---|
返回值
string数据属性的 HTML 标签属性字符串
renderField
用于获取包含标签和输入的控制组的方法。
renderField(mixed||string|int options = []) :
| 自 | 3.2 | 
|---|
参数
- options
- array<string|int, mixed>要传递到字段渲染中的选项
返回值
string包含控制组 HTML 的字符串
setCurrentUser
设置当前用户。
setCurrentUser(\Joomla\CMS\User\User currentUser) :
setForm
用于将表单对象附加到字段的方法。
setForm(\Joomla\CMS\Form\Form form) : \Joomla\CMS\Form\FormField
setup
用于将表单对象附加到字段的方法。
setup(\SimpleXMLElement element, value, group = null) :
| 参见 | FormField::setup() | 
|---|---|
| 自 | 3.2 | 
参数
- element
- SimpleXMLElement表示表单字段对象的- <field>标签的 SimpleXMLElement 对象。
- value
- mixed要验证的表单字段值。
- group
- string字段名称组控件值。它充当字段的数组容器。例如,如果字段名称为“foo”,并且组值为“bar”,则完整的字段名称最终将为“bar[foo]”。
返回值
bool成功时为 True。
setValue
用于设置值的方法
setValue( value) :
| 自 | 3.2 | 
|---|
参数
- value
- mixed要设置的值
返回值
void
validate
用于根据字段数据验证 FormField 对象的方法。
validate( value, group = null, \Joomla\Registry\Registry input = null) : bool|\Exception
| 自 | 4.0.0 | 
|---|---|
| 抛出 | 
 
 | 
参数
- value
- mixed用作字段默认值的可选值。
- group
- string要查找字段的可选点分隔表单组路径。
- input
- Registry|null一个可选的 Registry 对象,其中包含要针对整个表单进行验证的整个数据集。
返回值
bool|Exception如果字段值有效则为布尔值 true,失败时为异常。
属性
描述
表单字段的描述文本。通常用于工具提示。
| 自 | 1.7.0 | 
|---|
类型
string
            提示
表单字段的提示文本,用于在字段内显示提示。
| 自 | 3.2 | 
|---|
类型
string
            自动完成
表单字段的自动完成状态。如果为“off”,则浏览器不会自动完成元素。
| 自 | 3.2 | 
|---|
类型
混合类型
            拼写检查
表单字段的拼写检查状态。
| 自 | 3.2 | 
|---|
类型
布尔值
            自动聚焦
表单字段的自动聚焦请求。如果为 true,则元素将在文档加载时自动获得焦点。
| 自 | 3.2 | 
|---|
类型
布尔值
            element
描述表单字段的 <field> XML 元素的 SimpleXMLElement 对象。
| 自 | 1.7.0 | 
|---|
类型
SimpleXMLElement
            formControl
来自附加到表单字段的表单对象的字段名称的表单控件前缀。
| 自 | 1.7.0 | 
|---|
类型
string
            translateLabel
是否翻译字段标签字符串。
| 自 | 1.7.0 | 
|---|
类型
布尔值
            translateDescription
是否翻译字段描述字符串。
| 自 | 1.7.0 | 
|---|
类型
布尔值
            translateHint
是否翻译字段提示字符串。
| 自 | 3.2 | 
|---|
类型
布尔值
            id
表单字段的文档 ID。
| 自 | 1.7.0 | 
|---|
类型
string
            input
表单字段的输入。
| 自 | 1.7.0 | 
|---|
类型
string
            标签
表单字段的标签。
| 自 | 1.7.0 | 
|---|
类型
string
            multiple
表单字段的多选状态。如果为 true,则允许字段具有多个值。最常用于列表字段类型。
| 自 | 1.7.0 | 
|---|
类型
布尔值
            重复
允许扩展创建重复元素
| 自 | 3.2 | 
|---|
类型
混合类型
            模式
表单字段值的模式(正则表达式)。
| 自 | 1.7.0 | 
|---|
类型
string
            validationtext
表单字段无效值的验证文本。
| 自 | 4.0.0 | 
|---|
类型
string
            name
表单字段的名称。
| 自 | 1.7.0 | 
|---|
类型
string
            fieldname
字段的名称。
| 自 | 1.7.0 | 
|---|
类型
string
            group
字段的组。
| 自 | 1.7.0 | 
|---|
类型
string
            必需
表单字段的必需状态。如果为 true,则必须有字段值才能被视为有效。
| 自 | 1.7.0 | 
|---|
类型
布尔值
            禁用
表单字段的禁用状态。如果为 true,则该字段将被禁用,用户无法与该字段交互。
| 自 | 3.2 | 
|---|
类型
布尔值
            只读
表单字段的只读状态。如果为 true,则该字段将为只读。
| 自 | 3.2 | 
|---|
类型
布尔值
            类型
表单字段类型。
| 自 | 1.7.0 | 
|---|
类型
string
            validate
表单字段的验证方法。此值将确定用于验证字段值的哪种方法。
| 自 | 1.7.0 | 
|---|
类型
string
            value
表单字段的值。
| 自 | 1.7.0 | 
|---|
类型
混合类型
            default
表单字段的默认值。
| 自 | 1.7.0 | 
|---|
类型
混合类型
            大小
表单字段的大小。
| 自 | 3.2 | 
|---|
类型
整数
            类
表单字段的类
| 自 | 3.2 | 
|---|
类型
混合类型
            标签类
表单字段标签的 CSS 类
| 自 | 1.7.0 | 
|---|
类型
混合类型
            onchange
表单字段的 JavaScript onchange 事件。
| 自 | 3.2 | 
|---|
类型
string
            onclick
表单字段的 JavaScript onclick 事件。
| 自 | 3.2 | 
|---|
类型
string
            显示条件
显示/隐藏字段的条件。
| 自 | 3.7.0 | 
|---|
类型
string
            父类
字段的父类
| 自 | 4.0.0 | 
|---|
类型
string
            计数
为生成的名称字段生成的计数值
| 自 | 1.7.0 | 
|---|
类型
整数
            生成的字段名称
用于生成字段名称的字符串
| 自 | 1.7.0 | 
|---|
类型
string
            布局
用于渲染字段的布局名称
| 自 | 4.0.0 | 
|---|
类型
string
            布局数据
布局渲染的缓存数据
| 自 | 5.1.0 | 
|---|
类型
array<string|int, mixed>
            渲染布局
渲染表单字段的布局
类型
string
            渲染标签布局
渲染标签的布局
类型
string
            数据属性
表单字段的数据属性名称和值。
例如,data-action-type="click" data-action-type="change"
| 自 | 4.0.0 | 
|---|
类型
array<string|int, mixed>
            标题
标题。
| 自 | 4.3.0 | 
|---|
类型
混合类型
            键字段
键字段。
| 自 | 3.2 | 
|---|
类型
string
            值字段
值字段。
| 自 | 3.2 | 
|---|
类型
string
            翻译
翻译。
| 自 | 3.2 | 
|---|
类型
布尔值
            查询
查询。
| 自 | 3.2 | 
|---|
类型
string