I searched in API without success. There is an incomplete description of the keys of $htmlOption. I am particularly interested in some public methods like "fileField($model, $attribute, $htmlOptions=array ())" and others of class CActiveForm.
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
- Using similar_text and strpos together
In general, the $htmlOptions array is described by the HTML element being generated. The array is literally the "attributes" of the HTML element. The keys are the attributes names. So if you are generating an image with CHtml::Image then "src" is a valid $htmlOption key. If you generating a CHtml::Link, then "href" is a valid $htmlOption key.
If you look in the documentation, the description for $htmlOptions parameter of the CHtml::link() element is:
I usually use the $htmlOptions array to add classes, IDs or styles to an HTML element, like so:
This would render the following code:
There are a couple of extra "special" AJAX options that Yii allows in the $htmlOptions array for some elements (link, button, and a few others). They let you create AJAX links, add JS confirm popups, etc. These options are described here:
http://www.yiiframework.com/doc/api/CHtml#clientChange-detail
For the fileField element, you can look up the relevant attributes here which will be allowed in the $htmlOptions array.