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


PHP UploadField::setConfig方法代码示例

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


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

示例1: updateSiteCMSFields

 public function updateSiteCMSFields(FieldList $fields)
 {
     $fields->addFieldToTab('Root.Main', $gaCode = new TextField('GACode', 'Google Analytics account'));
     $gaCode->setRightTitle('Account number to be used all across the site (in the format <strong>UA-XXXXX-X</strong>)');
     $fields->addFieldToTab('Root.SocialMedia', $facebookURL = new TextField('FacebookURL', 'Facebook UID or username'));
     $facebookURL->setRightTitle('Facebook link (everything after the "http://facebook.com/", eg http://facebook.com/<strong>username</strong> or http://facebook.com/<strong>pages/108510539573</strong>)');
     $fields->addFieldToTab('Root.SocialMedia', $twitterUsername = new TextField('TwitterUsername', 'Twitter username'));
     $twitterUsername->setRightTitle('Twitter username (eg, http://twitter.com/<strong>username</strong>)');
     $fields->addFieldToTab('Root.SocialMedia', $addThisID = new TextField('AddThisProfileID', 'AddThis Profile ID'));
     $addThisID->setRightTitle('Profile ID to be used all across the site (in the format <strong>ra-XXXXXXXXXXXXXXXX</strong>)');
     $fields->addFieldToTab('Root.Logos/Icons', $favIconField = new UploadField('FavIcon', 'Favicon, in .ico format, dimensions of 16x16, 32x32, or 48x48'));
     $favIconField->getValidator()->setAllowedExtensions(array('ico'));
     $favIconField->setConfig('allowedMaxFileNumber', 1);
     $fields->addFieldToTab('Root.Logos/Icons', $atIcon144 = new UploadField('AppleTouchIcon144', 'Apple Touch Web Clip and Windows 8 Tile Icon (dimensions of 144x144, PNG format)'));
     $atIcon144->getValidator()->setAllowedExtensions(array('png'));
     $atIcon144->setConfig('allowedMaxFileNumber', 1);
     $fields->addFieldToTab('Root.Logos/Icons', $atIcon114 = new UploadField('AppleTouchIcon114', 'Apple Touch Web Clip Icon (dimensions of 114x114, PNG format)'));
     $atIcon114->getValidator()->setAllowedExtensions(array('png'));
     $atIcon114->setConfig('allowedMaxFileNumber', 1);
     $fields->addFieldToTab('Root.Logos/Icons', $atIcon72 = new UploadField('AppleTouchIcon72', 'Apple Touch Web Clip Icon (dimensions of 72x72, PNG format)'));
     $atIcon72->getValidator()->setAllowedExtensions(array('png'));
     $atIcon72->setConfig('allowedMaxFileNumber', 1);
     $fields->addFieldToTab('Root.Logos/Icons', $atIcon57 = new UploadField('AppleTouchIcon57', 'Apple Touch Web Clip Icon (dimensions of 57x57, PNG format)'));
     $atIcon57->getValidator()->setAllowedExtensions(array('png'));
     $atIcon57->setConfig('allowedMaxFileNumber', 1);
 }
开发者ID:helpfulrobot,项目名称:silverstripe-australia-ba-sis,代码行数:26,代码来源:SISSite.php

示例2: getCMSFields

 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->removeByName("FlexSliderID");
     // Main
     $field_Picture = new UploadField('Picture', _t("FlexSlider.Picture"));
     $field_Picture->setFolderName("FlexSlides");
     $field_Picture->setConfig('allowedMaxFileNumber', 1);
     $field_Position = new NumericField("Position", _t("FlexSlider.Position"));
     $field_Position->RightTitle(_t("FlexSlider.PositionExplain"));
     $field_SlideTitle = new TextField("SlideTitle", _t("FlexSlider.Title"));
     $field_SlideDescription = new TextField("SlideDescription", _t("FlexSlider.Description"));
     $field_HeadlineLinks = new HeaderField("HeadlineLinks", _t("FlexSlider.HeadlineLinks"));
     $field_InternalLink = new TreeDropdownField("InternalLinkID", _t('FlexSlider.InternalLink'), 'SiteTree');
     $field_removeInternalLink = new CheckboxField("doRemoveInternalLink", _t("FlexSlider.doRemoveInternalLink"));
     $field_ExternalLink = new TextField("ExternalLink", _t("FlexSlider.or") . " " . _t("FlexSlider.ExternalLink"));
     $field_HeadlineEnabled = new HeaderField("HeadlineEnabled", _t("FlexSlider.HeadlineEnabled"));
     $field_isEnabled = new CheckboxField("isEnabled", _t("FlexSlider.isEnabled"));
     $FieldsArray = array($field_Position, $field_Picture, $field_SlideTitle, $field_SlideDescription, $field_InternalLink, $field_removeInternalLink, $field_ExternalLink, $field_HeadlineEnabled, $field_isEnabled);
     $fields->addFieldToTab('Root.Main', $field_Position);
     $fields->addFieldToTab('Root.Main', $field_Picture);
     $fields->addFieldToTab('Root.Main', $field_SlideTitle);
     $fields->addFieldToTab('Root.Main', $field_SlideDescription);
     $fields->addFieldToTab('Root.Main', $field_HeadlineLinks);
     $fields->addFieldToTab('Root.Main', $field_InternalLink);
     $fields->addFieldToTab('Root.Main', $field_removeInternalLink);
     $fields->addFieldToTab('Root.Main', $field_ExternalLink);
     $fields->addFieldToTab('Root.Main', $field_HeadlineEnabled);
     $fields->addFieldToTab('Root.Main', $field_isEnabled);
     return $fields;
 }
开发者ID:vinstah,项目名称:body,代码行数:31,代码来源:FlexSlide.php

示例3: updateCMSFields

 public function updateCMSFields(FieldList $fields)
 {
     // Main
     $fields->addFieldToTab('Root.Main', $gaCode = new TextField('GACode', 'Google Analytics account'));
     $gaCode->setRightTitle('Account number to be used all across the site (in the format <strong>UA-XXXXX-X</strong>)');
     $fields->addFieldToTab('Root.Main', $showTitle = new CheckboxField('ShowTitleInHeader', 'Show title in header'), 'Tagline');
     /* @var $logoField UploadField */
     $logoField = new UploadField('Logo', 'Large logo, to appear in the header.');
     $logoField->setAllowedFileCategories('image');
     $logoField->setConfig('allowedMaxFileNumber', 1);
     $mobileLogoField = new UploadField('LogoMobile', 'Mobile logo, to appear in the header.');
     $mobileLogoField->setAllowedFileCategories('image');
     $mobileLogoField->setConfig('allowedMaxFileNumber', 1);
     $fields->addFieldToTab('Root.Main', $logoField);
     $fields->addFieldToTab('Root.Main', $this->getLogoOffSetField());
     $fields->addFieldToTab('Root.Main', $mobileLogoField);
     $fields->addFieldToTab('Root.Main', $this->getMobileLogoOffSetField());
     //Footer
     $fields->addFieldToTab('Root.Footer', $footerLogoField = new UploadField('FooterLogo', 'Footer logo, to appear in the bottom right.'));
     $footerLogoField->setAllowedFileCategories('image');
     $footerLogoField->setConfig('allowedMaxFileNumber', 1);
     $fields->addFieldToTab('Root.Footer', $footerLink = new TextField('FooterLogoLink', 'Footer Logo link'));
     $footerLink->setRightTitle('Please include the protocol (ie, http:// or https://) unless it is an internal link.');
     $fields->addFieldToTab('Root.Footer', new TextField('FooterLogoDescription', 'Footer Logo description'));
     $fields->addFieldToTab('Root.Footer', new TreeMultiselectField('FooterLinks', 'Footer Links', 'SiteTree'));
     $fields->addFieldToTab('Root.Footer', new TextField('Copyright', 'Copyright'));
 }
开发者ID:guru-digital,项目名称:gdm-ss-express,代码行数:27,代码来源:SSGDMExpressSiteConfig.php

示例4: getProfileFields

 /**
  * @return array
  */
 protected function getProfileFields()
 {
     //TODO gender enum
     $postcode = new RegexTextField('Postcode', _t('Addressable.POSTCODE', 'Postcode'));
     $postcode->setRegex($this->postcodeRegex);
     $fields = array(new HeaderField('ProfileHeader', _t('Profileable.PROFILE', 'Profile')), new OptionsetField('Gender', _t('Profileable.GENDER', 'Gender'), array('m' => _t('Profileable.MASCULINE', 'masculine'), 'f' => _t('Profileable.FEMININE', 'feminine'), 'u' => _t('Profileable.UNKNOWN', 'unknown')), 'u'), new TextField('AcademicTitle', _t('Profileable.ACADEMICTITLE', 'Name')), new TextField('ProfileName', _t('Profileable.NAME', 'Name')), new TextField('Company', _t('Profileable.COMPANY', 'Company')), new TextField('Position', _t('Profileable.POSITION', 'Position')), new TextField('Address', _t('Addressable.ADDRESS', 'Address')), new TextField('AddressAddition', _t('Profileable.ADDRESSADDITION', 'Address Addition')), $postcode, new TextField('City', _t('Profileable.CITY', 'City')), new TextField('Suburb', _t('Addressable.SUBURB', 'Suburb')));
     $label = _t('Addressable.STATE', 'State');
     if (is_array($this->allowedStates)) {
         $fields[] = new DropdownField('State', $label, $this->allowedStates);
     } elseif (!is_string($this->allowedStates)) {
         $fields[] = new TextField('State', $label);
     }
     $label = _t('Addressable.COUNTRY', 'Country');
     if (is_array($this->allowedCountries)) {
         $fields[] = new DropdownField('Country', $label, $this->allowedCountries);
     } elseif (!is_string($this->allowedCountries)) {
         $fields[] = new CountryDropdownField('Country', $label);
     }
     $fields[] = new TextField('Phone', _t('Profileable.PHONE', 'Phone'));
     $fields[] = new TextField('Fax', _t('Profileable.FAX', 'Fax'));
     $fields[] = new EmailField('ProfileEmail', _t('Profileable.EMAIL', 'E-Mail'));
     $fields[] = new TextField('Www', _t('Profileable.WWW', 'Homepage'));
     $profileUpload = new UploadField('ProfilePicture', _t('Profileable.PROFILEPICTURE', 'Profile Picture'));
     $profileUpload->allowedExtensions = self::$ProfilePictureAllowedTypes;
     $profileUpload->setFolderName(self::$ProfilePictureFolder);
     $profileUpload->setConfig('allowedMaxFileNumber', 1);
     $fields[] = $profileUpload;
     $fields[] = new TextareaField('Description', _t('Profileable.DESCRIPTION', 'Description'));
     return $fields;
 }
开发者ID:ivoba,项目名称:silverstripe-profileable,代码行数:33,代码来源:Profileable.php

示例5: getCMSFields

 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     // mp4 upload
     $MP4Field = new UploadField('MP4Video', 'MP4 Video');
     $MP4Field->getValidator()->setAllowedExtensions(array('mp4', 'm4v'));
     $MP4Field->setFolderName('Uploads/video');
     $MP4Field->setConfig('allowedMaxFileNumber', 1);
     // ogg upload
     $OggField = new UploadField('OggVideo', 'Ogg Video');
     $OggField->getValidator()->setAllowedExtensions(array('ogv', 'ogg'));
     $OggField->setFolderName('Uploads/video');
     $OggField->setConfig('allowedMaxFileNumber', 1);
     // mp4 upload
     $WebMField = new UploadField('WebMVideo', 'WebM Video');
     $WebMField->getValidator()->setAllowedExtensions(array('webm'));
     $WebMField->setFolderName('Uploads/video');
     $WebMField->setConfig('allowedMaxFileNumber', 1);
     // poster
     $PosterField = new UploadField('Poster', 'Poster Image');
     $PosterField->allowedExtensions = array('jpg', 'gif', 'png');
     $PosterField->setFolderName('Uploads/videoposters');
     $PosterField->setConfig('allowedMaxFileNumber', 1);
     $fields->addFieldsToTab('Root.Video', array($MP4Field, $OggField, $WebMField, $PosterField));
     return $fields;
 }
开发者ID:jsirish,项目名称:silverstripe-html5video,代码行数:26,代码来源:Video.php

示例6: getCMSFields

 function getCMSFields()
 {
     $f = parent::getCMSFields();
     $f->removeByName(array('SortOrder', 'Image'));
     $f->removeByName('SortOrder');
     $f->addFieldsToTab('Root.Main', HtmlEditorField::create("Description")->setRows(15));
     $f->addFieldsToTab('Root.Image', $HeroImage = new UploadField('Image', 'Please upload a Hero image <span>(max. 1 files)</span>'));
     $HeroImage->setAllowedFileCategories('image');
     $HeroImage->setAllowedMaxFileNumber(1);
     $HeroImage->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif'));
     $HeroImage->setConfig('allowedMaxFileNumber', 1);
     $HeroImage->setFolderName('Uploads/Distributors/' . $this->URLSegment);
     return $f;
 }
开发者ID:helpfulrobot,项目名称:chitosystems-silverstripe-distributor-map,代码行数:14,代码来源:Distributor.php

示例7: getCMSFields

 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $ImageField = new UploadField('Image', 'Image');
     $ImageField->getValidator()->allowedExtensions = array('jpg', 'jpeg', 'gif', 'png');
     $ImageField->setFolderName('Uploads/SlideImages');
     $ImageField->setConfig('allowedMaxFileNumber', 1);
     $ImageField->getValidator()->setAllowedMaxFileSize(FLEXSLIDER_IMAGE_FILE_SIZE_LIMIT);
     $fields->removeByName(array('ShowSlide'));
     $fields->addFieldsToTab('Root.Main', array(TextField::create('Name'), TextareaField::create('Description'), TreeDropdownField::create('PageLinkID', 'Choose a page to link to:', 'SiteTree'), $ImageField, CheckboxField::create('ShowSlide')->setTitle('Show Slide')->setDescription('Include this slide in the slider. Uncheck to hide')));
     $fields->removeByName(array('SortOrder', 'PageID'));
     $this->extend('updateCMSFields', $fields);
     return $fields;
 }
开发者ID:korthjp17,项目名称:SilverStripe-FlexSlider,代码行数:14,代码来源:SlideImage.php

示例8: updateCMSFields

 public function updateCMSFields(FieldList $fields)
 {
     $footerLinks = new GridField('FooterLinks', 'FooterLinks', $this->owner->FooterLinks(), $conf = GridFieldConfig_RelationEditor::create());
     $conf->addComponent(new GridFieldOrderableRows('Sort'));
     $footerLinks->getConfig()->getComponentByType('GridFieldAddNewButton')->setButtonName('Add Link to Footer');
     $fields->addFieldToTab('Root.Footer', $footerLinks);
     $fields->addFieldToTab('Root.Main', $gaCode = new TextField('GACode', 'Google Analytics account'));
     $gaCode->setRightTitle('Account number to be used all across the site (in the format <strong>UA-XXXXX-X</strong>)');
     $fields->addFieldToTab('Root.SocialMedia', $facebookURL = new TextField('FacebookURL', 'Facebook UID or username'));
     $facebookURL->setRightTitle('Facebook link (everything after the "http://facebook.com/", eg http://facebook.com/<strong>username</strong> or http://facebook.com/<strong>pages/108510539573</strong>)');
     $fields->addFieldToTab('Root.SocialMedia', $twitterUsername = new TextField('TwitterUsername', 'Twitter username'));
     $twitterUsername->setRightTitle('Twitter username (eg, http://twitter.com/<strong>username</strong>)');
     $fields->addFieldToTab('Root.Logos', $logoField = new UploadField('Logo', 'Logo'));
     $logoField->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif'));
     $logoField->setConfig('allowedMaxFileNumber', 1);
     $fields->addFieldToTab('Root.Logos', new TextField('LogoText', 'Logo Text'));
 }
开发者ID:adrexia,项目名称:nzlarps,代码行数:17,代码来源:CustomSiteConfig.php

示例9: getUploadField

 /**
  * Returns a form field for uploading a file. 
  *   Attempts to use the Uploadify module if present.
  * @param string $fieldName Form Field Name
  * @param string $fieldTitle Form Field Title
  * @param array|null $fileTypes Array of allowed extensions (e.g. array('gif','jpg'))
  * @param string|null $subfolder Files will be uploaded to this subfolder of the Media Type's $media_upload_folder 
  * @return FormField
  */
 public function getUploadField($fieldName, $fieldTitle = null, $fileTypes = null, $subfolder = null)
 {
     $allowed_file_types = is_array($fileTypes) ? $fileTypes : Config::inst()->get($this->MediaType, 'allowed_file_types');
     $folder = property_exists($this, 'media_upload_folder') ? $this->media_upload_folder : Config::inst()->get($this->MediaType, 'media_upload_folder');
     $folder .= '/' . date('Y-m') . ($subfolder ? '/' . $subfolder : '');
     $field = new UploadField($name = $fieldName, $title = $fieldTitle);
     $field->setFolderName($folder);
     if ($allowed_file_types) {
         $field->getValidator()->setAllowedExtensions($allowed_file_types);
     }
     // determine if we are in admin or front-end, hide attaching existing files if in front-end.
     $admin_base = Config::inst()->get('LeftAndMain', 'url_base');
     if (!substr(Controller::curr()->getRequest()->getURL(), 0, strlen($admin_base) + 1) == $admin_base . '/') {
         $field->setConfig('canAttachExisting', false);
     }
     return $field;
 }
开发者ID:helpfulrobot,项目名称:briceburg-silverstripe-sitemedia,代码行数:26,代码来源:SiteMedia.php

示例10: updateCMSFields

 public function updateCMSFields(FieldList $fields)
 {
     $footerBanner = new UploadField('FooterBanner', 'Footer Banner');
     $footerBanner->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif'));
     $footerBanner->setConfig('allowedMaxFileNumber', 1);
     $footerBannerLink = new TreeDropdownField('FooterBannerLinkID', 'Footer Banner Link', "SiteTree");
     $fields->addFieldToTab('Root.Footer', $footerBanner);
     $fields->addFieldToTab('Root.Footer', $footerBannerLink);
     $fields->addFieldToTab('Root.Main', $gaCode = new TextField('GACode', 'Google Analytics account'));
     $gaCode->setRightTitle('Account number to be used all across the site (in the format <strong>UA-XXXXX-X</strong>)');
     $fields->addFieldToTab('Root.SocialMedia', $facebookURL = new TextField('FacebookURL', 'Facebook UID or username'));
     $facebookURL->setRightTitle('Facebook link (everything after the "http://facebook.com/", eg http://facebook.com/<strong>username</strong> or http://facebook.com/<strong>pages/108510539573</strong>)');
     $fields->addFieldToTab('Root.SocialMedia', $twitterUsername = new TextField('TwitterUsername', 'Twitter username'));
     $twitterUsername->setRightTitle('Twitter username (eg, http://twitter.com/<strong>username</strong>)');
     $fields->addFieldToTab('Root.Logos', $logoField = new UploadField('Logo', 'Logo, to appear in the top left.'));
     $logoField->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif'));
     $logoField->setConfig('allowedMaxFileNumber', 1);
     $fields->addFieldToTab('Root.Logos', new TextField('LogoText', 'Logo Text'));
 }
开发者ID:adrexia,项目名称:chimera,代码行数:19,代码来源:CustomSiteConfig.php

示例11: updateCMSFields

 function updateCMSFields(FieldList $fields)
 {
     $fields->addFieldToTab('Root.Main', $gaCode = new TextField('GACode', 'Google Analytics account'));
     $gaCode->setRightTitle('Account number to be used all across the site (in the format <strong>UA-XXXXX-X</strong>)');
     $fields->addFieldToTab('Root.SocialMedia', $facebookURL = new TextField('FacebookURL', 'Facebook UID or username'));
     $facebookURL->setRightTitle('Facebook link (everything after the "http://facebook.com/", eg http://facebook.com/<strong>username</strong> or http://facebook.com/<strong>pages/108510539573</strong>)');
     $fields->addFieldToTab('Root.SocialMedia', $twitterUsername = new TextField('TwitterUsername', 'Twitter username'));
     $twitterUsername->setRightTitle('Twitter username (eg, http://twitter.com/<strong>username</strong>)');
     $fields->addFieldToTab('Root.SocialMedia', $addThisID = new TextField('AddThisProfileID', 'AddThis Profile ID'));
     $addThisID->setRightTitle('Profile ID to be used all across the site (in the format <strong>ra-XXXXXXXXXXXXXXXX</strong>)');
     $fields->addFieldToTab('Root.Logos', $logoField = new UploadField('Logo', 'Logo, to appear in the top left.'));
     $logoField->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif'));
     $logoField->setConfig('allowedMaxFileNumber', 1);
     $fields->addFieldToTab('Root.Logos', $footerLogoField = new UploadField('FooterLogo', 'Footer logo, to appear in the bottom right.'));
     $footerLogoField->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif'));
     $footerLogoField->setConfig('allowedMaxFileNumber', 1);
     $fields->addFieldToTab('Root.Logos', $footerLink = new TextField('FooterLogoLink', 'Footer Logo link'));
     $footerLink->setRightTitle('Please include the protocol (ie, http:// or https://) unless it is an internal link.');
     $fields->addFieldToTab('Root.Logos', new TextField('FooterLogoDescription', 'Footer Logo description'));
 }
开发者ID:helpfulrobot,项目名称:gdmedia-silverstripe-gdm-express,代码行数:20,代码来源:CustomSiteConfig.php

示例12: getCMSFields

 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->addFieldToTab('Root.Main', new TextField('Author', _t('NewsArticle.AUTHOR', 'Author')), 'Content');
     $fields->addFieldToTab('Root.Main', $dp = new DateField('OriginalPublishedDate', _t('NewsArticle.PUBLISHED_DATE', 'When was this article first published?')), 'Content');
     $dp->setConfig('showcalendar', true);
     $fields->addFieldToTab('Root.Main', new TextField('ExternalURL', _t('NewsArticle.EXTERNAL_URL', 'External URL to article (will automatically redirect to this URL if no article content set)')), 'Content');
     $fields->addFieldToTab('Root.Main', new TextField('Source', _t('NewsArticle.SOURCE', 'News Source')), 'Content');
     $fields->addFieldToTab('Root.Main', $if = new UploadField('Thumbnail', _t('NewsArticle.THUMB', 'Thumbnail')), 'Content');
     $if->setConfig('allowedMaxFileNumber', 1)->setFolderName('news-articles/thumbnails');
     $if->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif'));
     if (!$this->OriginalPublishedDate) {
         // @TODO Fix this to be correctly localized!!
         $this->OriginalPublishedDate = date('Y-m-d');
     }
     $fields->addFieldToTab('Root.Main', UploadField::create('InternalFile', _t('NewsArticle.INTERNAL_FILE', 'Select a file containing this news article, if any'))->setFolderName('news'), 'Content');
     $fields->addFieldToTab('Root.Main', $summary = new HtmlEditorField('Summary', _t('NewsArticle.SUMMARY', 'Article Summary (displayed in listings)')), 'Content');
     $summary->addExtraClass('stacked');
     $this->extend('updateArticleCMSFields', $fields);
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:silverstripers-silverstripe-news,代码行数:21,代码来源:NewsArticle.php

示例13: updateCMSFields

 public function updateCMSFields(FieldList $fields)
 {
     //$fields->addFieldToTab(HeaderImageBanner::$hibCMSTab, new DropDownField('hibHeaderImagesType', 'If no header image, select from', $this->dbObject('hibHeaderImagesType')->enumValues()));
     if (HeaderImageBanner::$hibCMSUserEdit) {
         if (isset(HeaderImageBanner::$hibCMSTabs[$this->owner->ClassName])) {
             $tabs = HeaderImageBanner::$hibCMSTabs[$this->owner->ClassName];
         } else {
             if (isset(HeaderImageBanner::$hibCMSTabs["default"])) {
                 $tabs = HeaderImageBanner::$hibCMSTabs["default"];
             } else {
                 $tabs = "Root.HeaderImageBanners";
             }
         }
         $upload = new UploadField('hibImages', HeaderImageBanner::hibGetCMSCaption());
         $upload->setConfig('allowedMaxFileNumber', 25);
         $upload->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'gif', 'png'));
         $fields->addFieldToTab($tabs, $upload);
         //	  	$fields->addFieldToTab($tabs, $upload = new UploadField('hibImages', HeaderImageBanner::hibGetCMSCaption()));
         //			$uf->setConfig('allowedMaxFileNumber', 10);
     }
 }
开发者ID:helpfulrobot,项目名称:exadium-silverstripe-module-header-image-banner,代码行数:21,代码来源:HeaderImageBanner.php

示例14: 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

示例15: getCMSFields

 /**
  * Returns the fields to power the edit screen of files in the CMS.
  * You can modify this FieldList by subclassing folder, or by creating a {@link DataExtension}
  * and implemeting updateCMSFields(FieldList $fields) on that extension.
  * 
  * @return FieldList
  */
 function getCMSFields()
 {
     // Preview
     if ($this instanceof Image) {
         $formattedImage = $this->getFormattedImage('SetWidth', Image::$asset_preview_width);
         $thumbnail = $formattedImage ? $formattedImage->URL : '';
         $previewField = new LiteralField("ImageFull", "<img id='thumbnailImage' class='thumbnail-preview' src='{$thumbnail}?r=" . rand(1, 100000) . "' alt='{$this->Name}' />\n");
     } else {
         $previewField = new LiteralField("ImageFull", $this->CMSThumbnail());
     }
     // Upload
     $uploadField = new UploadField('UploadField', 'Upload Field');
     $uploadField->setConfig('previewMaxWidth', 40);
     $uploadField->setConfig('previewMaxHeight', 30);
     $uploadField->setConfig('allowedMaxFileNumber', 1);
     //$uploadField->setTemplate('FileEditUploadField');
     if ($this->ParentID) {
         $parent = $this->Parent();
         if ($parent) {
             //set the parent that the Upload field should use for uploads
             $uploadField->setFolderName($parent->getFilename());
             $uploadField->setRecord($parent);
         }
     }
     //create the file attributes in a FieldGroup
     $filePreview = CompositeField::create(CompositeField::create($previewField)->setName("FilePreviewImage")->addExtraClass('cms-file-info-preview'), CompositeField::create(CompositeField::create(new ReadonlyField("FileType", _t('AssetTableField.TYPE', 'File type') . ':'), new ReadonlyField("Size", _t('AssetTableField.SIZE', 'File size') . ':', $this->getSize()), $urlField = new ReadonlyField('ClickableURL', _t('AssetTableField.URL', 'URL'), sprintf('<a href="%s" target="_blank">%s</a>', $this->Link(), $this->RelativeLink())), new DateField_Disabled("Created", _t('AssetTableField.CREATED', 'First uploaded') . ':'), new DateField_Disabled("LastEdited", _t('AssetTableField.LASTEDIT', 'Last changed') . ':'), new ReadonlyField('BackLinkCount', _t('AssetTableField.BACKLINKCOUNT', 'Used on:'), $this->BackLinkTracking()->Count() . ' ' . _t('AssetTableField.PAGES', 'page(s)'))))->setName("FilePreviewData")->addExtraClass('cms-file-info-data'))->setName("FilePreview")->addExtraClass('cms-file-info');
     $urlField->dontEscape = true;
     //get a tree listing with only folder, no files
     $folderTree = new TreeDropdownField("ParentID", _t('AssetTableField.FOLDER', 'Folder'), 'Folder');
     $folderTree->setChildrenMethod('ChildFolders');
     $fields = new FieldList(new TabSet('Root', new Tab('Main', $filePreview, new TextField("Title", _t('AssetTableField.TITLE', 'Title')), new TextField("Name", _t('AssetTableField.FILENAME', 'Filename')), new DropdownField("OwnerID", _t('AssetTableField.OWNER', 'Owner'), Member::mapInCMSGroups()), $folderTree)));
     // Folder has its own updateCMSFields hook
     if (!$this instanceof Folder) {
         $this->extend('updateCMSFields', $fields);
     }
     return $fields;
 }
开发者ID:nzjoel,项目名称:sapphire,代码行数:44,代码来源:File.php


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