本文整理汇总了PHP中FileField::FieldHolder方法的典型用法代码示例。如果您正苦于以下问题:PHP FileField::FieldHolder方法的具体用法?PHP FileField::FieldHolder怎么用?PHP FileField::FieldHolder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileField
的用法示例。
在下文中一共展示了FileField::FieldHolder方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: FieldHolder
/**
* Renders the form field, loads requirements. Sets file size based on php.ini
* Adds the security token
*
* @param array $attributes [description]
* @return SSViewer
*/
public function FieldHolder($attributes = array())
{
Requirements::javascript(DROPZONE_DIR . '/javascript/dropzone.js');
Requirements::javascript(DROPZONE_DIR . '/javascript/file_attachment_field.js');
if ($this->isCMS()) {
Requirements::javascript(DROPZONE_DIR . '/javascript/file_attachment_field_backend.js');
}
Requirements::css(DROPZONE_DIR . '/css/file_attachment_field.css');
if (!$this->getSetting('url')) {
$this->settings['url'] = $this->Link('upload');
}
if (!$this->getSetting('maxFilesize')) {
$this->settings['maxFilesize'] = static::get_filesize_from_ini();
}
// The user may not have opted into a multiple upload. If the form field
// is attached to a record that has a multi relation, set that automatically.
$this->settings['uploadMultiple'] = $this->IsMultiple();
// Auto filter images if assigned to an Image relation
if ($class = $this->getFileClass()) {
if (Injector::inst()->get($class) instanceof Image) {
$this->imagesOnly();
}
}
if ($token = $this->getForm()->getSecurityToken()) {
$this->addParam($token->getName(), $token->getSecurityID());
}
return parent::FieldHolder($attributes);
}