CakePHP
  • 文档
    • 书籍
    • API
    • 视频
    • 报告安全问题
    • 隐私政策
    • 标识和商标
  • 商业解决方案
  • 商品
  • 自驾游
  • 团队
  • 社区
    • 社区
    • 参与
    • 问题 (Github)
    • 面包店
    • 精选资源
    • 培训
    • 聚会
    • 我的 CakePHP
    • CakeFest
    • 时事通讯
    • 领英
    • YouTube
    • 脸书
    • 推特
    • Mastodon
    • 帮助和支持
    • 论坛
    • Stack Overflow
    • IRC
    • Slack
    • 付费支持
CakePHP

C CakePHP 5.1 Chiffon API

  • 项目
    • CakePHP
      • CakePHP
      • Chronos
      • Elastic Search
      • 队列
  • 版本
    • 5.1
      • 5.1
      • 5.0
      • 4.5
      • 4.4
      • 4.3
      • 4.2
      • 4.1
      • 4.0
      • 3.10
      • 3.9
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

命名空间

  • 全局
  • Cake
    • Cache
    • Collection
    • Command
    • Console
    • Controller
    • Core
    • Database
    • Datasource
    • Error
    • Event
    • Form
    • Http
    • I18n
    • Log
    • Mailer
    • Network
    • ORM
    • Routing
    • TestSuite
    • Utility
    • Validation
    • View
      • Exception
      • Form
      • Helper
      • Widget

类 YearWidget

用于生成日历年份选择框的输入小部件类。

此类通常由 Cake\View\Helper\FormHelper 内部使用,但可以用于生成独立的日历年份选择框。

命名空间: Cake\View\Widget

属性摘要

  • $_select protected
    Cake\View\Widget\SelectBoxWidget

    选择框小部件。

  • $_templates protected
    Cake\View\StringTemplate

    StringTemplate 实例。

  • $defaults protected
    array<string, mixed>

    数据默认值。

方法摘要

  • __construct() public

    构造函数

  • mergeDefaults() protected

    将默认值与提供的數據合併。

  • render() public

    渲染年份选择框。

  • secureFields() public

    返回需要为此小部件进行安全保护的字段列表。

  • setMaxLength() protected

    如果适用,设置 "maxlength" 属性的值。

  • setRequired() protected

    如果适用,设置 "required" 属性的值。

  • setStep() protected

    如果适用,设置 "step" 属性的值。

方法詳情

__construct() ¶ public

__construct(Cake\View\StringTemplate $templates, Cake\View\Widget\SelectBoxWidget $selectBox)

构造函数

参数
Cake\View\StringTemplate $templates

模板列表。

Cake\View\Widget\SelectBoxWidget $selectBox

Selectbox 小部件实例。

mergeDefaults() ¶ protected

mergeDefaults(array<string, mixed> $data, Cake\View\Form\ContextInterface $context): array<string, mixed>

将默认值与提供的數據合併。

参数
array<string, mixed> $data

数据数组

Cake\View\Form\ContextInterface $context

上下文实例。

返回
array<string, mixed>

render() ¶ public

render(array<string, mixed> $data, Cake\View\Form\ContextInterface $context): string

渲染年份选择框。

此方法接受多个键

  • name name 属性。
  • val value 属性。
  • escape 设置为 false 以禁用对所有属性的转义。

$data 中提供的任何其他键将被转换为 HTML 属性。

参数
array<string, mixed> $data

要渲染的数据。

Cake\View\Form\ContextInterface $context

当前表单上下文。

返回
string

secureFields() ¶ public

secureFields(array<string, mixed> $data): list<string>

返回需要为此小部件进行安全保护的字段列表。

参数
array<string, mixed> $data
返回
list<string>

setMaxLength() ¶ protected

setMaxLength(array<string, mixed> $data, Cake\View\Form\ContextInterface $context, string $fieldName): array<string, mixed>

如果适用,设置 "maxlength" 属性的值。

参数
array<string, mixed> $data

数据数组

Cake\View\Form\ContextInterface $context

上下文实例。

string $fieldName

字段名称。

返回
array<string, mixed>

setRequired() ¶ protected

setRequired(array<string, mixed> $data, Cake\View\Form\ContextInterface $context, string $fieldName): array<string, mixed>

如果适用,设置 "required" 属性的值。

参数
array<string, mixed> $data

数据数组

Cake\View\Form\ContextInterface $context

上下文实例。

string $fieldName

字段名称。

返回
array<string, mixed>

setStep() ¶ protected

setStep(array<string, mixed> $data, Cake\View\Form\ContextInterface $context, string $fieldName): array<string, mixed>

如果适用,设置 "step" 属性的值。

参数
array<string, mixed> $data

数据数组

Cake\View\Form\ContextInterface $context

上下文实例。

string $fieldName

字段名称。

返回
array<string, mixed>

属性詳情

$_select ¶ protected

选择框小部件。

类型
Cake\View\Widget\SelectBoxWidget

$_templates ¶ protected

StringTemplate 实例。

类型
Cake\View\StringTemplate

$defaults ¶ protected

数据默认值。

类型
array<string, mixed>
OpenHub
Pingping
Linode
  • 商业解决方案
  • 展示
  • 文档
  • 书籍
  • API
  • 视频
  • 报告安全问题
  • 隐私政策
  • 标识和商标
  • 社区
  • 参与
  • 问题 (Github)
  • 面包店
  • 精选资源
  • 培训
  • 聚会
  • 我的 CakePHP
  • CakeFest
  • 时事通讯
  • 领英
  • YouTube
  • 脸书
  • 推特
  • Mastodon
  • 帮助和支持
  • 论坛
  • Stack Overflow
  • IRC
  • Slack
  • 付费支持

使用 CakePHP API 文档 生成