Zend Framework 2:关于用于将元素添加到可用表单的 add() 方法的任何文档?
Zend Framework 2: Any documentation on the add() method used to add elements to forms available?
在 Zend Framework 2 中创建表单或字段集时,我使用 add()
方法向其添加字段。通常,这看起来像这样不起眼:
$this->add(array(
'type' => 'text',
'name' => 'fieldName',
'options' => array(
'label' => 'Some Label'
),
));
该代码是从充满有用示例的 Reference Guide 中复制的,但不幸的是它没有列出所有可用的数组键。
当然我已经检查了 API docs,但这只告诉我
$flags could contain metadata such as the alias under which to register the element or fieldset, order in which to prioritize it, etc.
这不是详细的文档。
我也直接查看了 source,但这也没有为我回答任何问题,所以我想知道:
使用add()
方法时是否有任何关于可用数组键的文档?
你没看deep enough :).
给你:
name
:为元素设置名称。优先于名称
从元素规范。如果没有在元素中指定名称
或者在 flags 数组中抛出异常,因为未命名元素是
不允许出现在表格中。
priority
:改变元素在其他元素中的顺序。当使用 form
之类的视图助手来呈现整体时很有用
表格
请在 zf2 github 上添加一个 issue,我会贡献它。
在 Zend Framework 2 中创建表单或字段集时,我使用 add()
方法向其添加字段。通常,这看起来像这样不起眼:
$this->add(array(
'type' => 'text',
'name' => 'fieldName',
'options' => array(
'label' => 'Some Label'
),
));
该代码是从充满有用示例的 Reference Guide 中复制的,但不幸的是它没有列出所有可用的数组键。
当然我已经检查了 API docs,但这只告诉我
$flags could contain metadata such as the alias under which to register the element or fieldset, order in which to prioritize it, etc.
这不是详细的文档。
我也直接查看了 source,但这也没有为我回答任何问题,所以我想知道:
使用add()
方法时是否有任何关于可用数组键的文档?
你没看deep enough :).
给你:
name
:为元素设置名称。优先于名称 从元素规范。如果没有在元素中指定名称 或者在 flags 数组中抛出异常,因为未命名元素是 不允许出现在表格中。priority
:改变元素在其他元素中的顺序。当使用form
之类的视图助手来呈现整体时很有用 表格
请在 zf2 github 上添加一个 issue,我会贡献它。