当前位置: 首页>>代码示例>>PHP>>正文


PHP UploadField::setCanPreviewFolder方法代码示例

本文整理汇总了PHP中UploadField::setCanPreviewFolder方法的典型用法代码示例。如果您正苦于以下问题:PHP UploadField::setCanPreviewFolder方法的具体用法?PHP UploadField::setCanPreviewFolder怎么用?PHP UploadField::setCanPreviewFolder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UploadField的用法示例。


在下文中一共展示了UploadField::setCanPreviewFolder方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getUploadForm

 public static function getUploadForm($file, $parentClass, $parentId, $parentField)
 {
     if ($file instanceof File && class_exists($parentClass) && is_subclass_of($parentClass, "DataObject")) {
         $parent = $parentClass::get()->byId($parentId);
         $fields = new FieldList($uploadField = new UploadField($parentField, 'Upload', $parent));
         $uploadField->setCanAttachExisting(false);
         // Block access to Silverstripe assets library
         $uploadField->setCanPreviewFolder(false);
         // Don't show target filesystem folder on upload field
         $uploadField->relationAutoSetting = false;
         // Prevents the form thinking the GalleryPage is the underlying object
         $uploadField->setFolderName('Address Book');
         $uploadField->setAllowedMaxFileNumber(1);
         if ($file instanceof Image) {
             $uploadField->setAllowedFileCategories('image');
         }
         $actions = new FieldList(new FormAction('submit', 'Save'));
         $from = new Form(Controller::curr(), 'feFileUploadForm', $fields, $actions, null);
         $urlParams = array('feclass' => $parentClass, 'fefield' => $parentField, 'feid' => $parentId, 'filesUpload' => true, 'fefileid' => $file->ID, 'fefileclass' => $file->ClassName);
         //   feclass: parentClass,
         //                        fefield: parentField,
         //                        feid: parentId,
         //                        feisUpload: true,
         //                        value: "{feclass: " + objClass + ",feid: " + objId + "}"
         //            echo http_build_query($urlParams) . "\n";
         $from->setFormAction('home/feFileUploadForm?' . http_build_query($urlParams));
         return $from;
     }
 }
开发者ID:helpfulrobot,项目名称:gdmedia-silverstripe-frontend-admin,代码行数:29,代码来源:FrontendEditing.php

示例2: getCMSFields

 function getCMSFields()
 {
     $this->beforeUpdateCMSFields(function ($fields) {
         $datefield = new DateField('Date', 'Date (DD/MM/YYYY)*');
         $datefield->setConfig('showcalendar', true);
         $datefield->setConfig('dateformat', 'dd/MM/YYYY');
         $imagefield = new UploadField('Image', 'Image');
         $imagefield->allowedExtensions = array('jpg', 'gif', 'png');
         $imagefield->setFolderName("Managed/CalendarImages");
         $imagefield->setCanPreviewFolder(false);
         $fields->addFieldToTab('Root.Main', new TextField('Title', "Event Title*"));
         $fields->addFieldToTab('Root.Main', $datefield);
         $fields->addFieldToTab('Root.Main', new TextField('Time', "Time (HH:MM)"));
         $fields->addFieldToTab('Root.Main', new TextareaField('Description'));
         $fields->addFieldToTab('Root.Main', $imagefield);
     });
     $fields = parent::getCMSFields();
     $this->extend('updateCMSFields', $fields);
     $fields->removeFieldFromTab("Root.Main", "CalendarPageID");
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:purplespider-basic-calendar,代码行数:21,代码来源:CalendarEntry.php

示例3: getCMSFields

 public function getCMSFields()
 {
     $this->beforeUpdateCMSFields(function ($fields) {
         $datefield = new DateField('Date', 'Date (DD/MM/YYYY)');
         $datefield->setConfig('showcalendar', true);
         $datefield->setConfig('showdropdown', true);
         $datefield->setConfig('dateformat', 'dd/MM/YYYY');
         $fields->addFieldToTab('Root.Main', $datefield, 'Content');
         $image = new UploadField('AttachedImage', 'Main Image');
         $image->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif'));
         $image->setConfig('allowedMaxFileNumber', 1);
         $image->setFolderName('Managed/NewsImages');
         $image->setCanPreviewFolder(false);
         $image->setRightTitle("Displayed to the right of the content in the main article, where it can be clicked to enlarge. <br />A thumbnail also appears next to the article summary on the main News page.");
         $fields->addFieldToTab('Root.Main', $image, "Content");
     });
     $fields = parent::getCMSFields();
     $fields->renameField("Title", "Headline");
     $fields->removeFieldFromTab("Root.Main", "MenuTitle");
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:purplespider-basic-news,代码行数:21,代码来源:NewsArticle.php


注:本文中的UploadField::setCanPreviewFolder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。