本文整理汇总了PHP中FileField::setAttribute方法的典型用法代码示例。如果您正苦于以下问题:PHP FileField::setAttribute方法的具体用法?PHP FileField::setAttribute怎么用?PHP FileField::setAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileField
的用法示例。
在下文中一共展示了FileField::setAttribute方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CreateHeatmapForm
public function CreateHeatmapForm()
{
$includeWatermark = array("1" => "Yes,Include Watermark", "0" => "No,Remove Watermark");
$fields = new FieldList($imageField = new FileField('OriginalImage', 'Upload an Image File'), new LiteralField('UploadInfo', 'Acceptable images are jpg or png, 500-1600 pixels wide by 500-1200 pixels height.<hr>'), new OptionsetField('IncludeWatermark', 'Include Watermark?', $includeWatermark, 1));
$imageField->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png'));
$imageField->setAttribute('class', 'jfilestyle');
$imageField->setAttribute('data-buttonText', "<img src='themes/attwiz/images/button-create-heatmap-browse.jpg'></img>");
$imageField->setAttribute('data-placeholder', 'No file selected..');
// Create action
$actions = new FieldList($submit = new FormAction('processCreateHeatmap', ''));
$submit->setAttribute('src', 'themes/attwiz/images/button-create-heatmap-blue-bg.jpg');
// Create action
$validator = new RequiredFields('OriginalImage', 'IncludeWatermark');
return new Form($this, 'CreateHeatmapForm', $fields, $actions, $validator);
}