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


PHP UploadField::getRelationAutosetClass方法代码示例

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


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

示例1: getRelationAutosetClass

 /**
  * Gets the foreign class that needs to be created, or 'File' as default if there
  * is no relationship, or it cannot be determined.
  *
  * @param $default Default value to return if no value could be calculated
  * @return string Foreign class name.
  */
 public function getRelationAutosetClass($default = 'File')
 {
     if (empty($this->record_class)) {
         return parent::getRelationAutosetClass($default);
     }
     return $this->record_class;
 }
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:14,代码来源:CustomUploadField.php

示例2: getListField

 /**
  * @param $folderID The ID of the folder to display.
  * @return FormField
  */
 protected function getListField($folderID)
 {
     // Generate the folder selection field.
     $folderField = new TreeDropdownField('ParentID', _t('HtmlEditorField.FOLDER', 'Folder'), 'Folder');
     $folderField->setValue($folderID);
     // Generate the file list field.
     $config = GridFieldConfig::create();
     $config->addComponent(new GridFieldSortableHeader());
     $config->addComponent(new GridFieldFilterHeader());
     $config->addComponent($columns = new GridFieldDataColumns());
     $columns->setDisplayFields(array('StripThumbnail' => '', 'Name' => 'Name', 'Title' => 'Title'));
     $config->addComponent(new GridFieldPaginator(8));
     // If relation is to be autoset, we need to make sure we only list compatible objects.
     $baseClass = $this->parent->getRelationAutosetClass();
     // Create the data source for the list of files within the current directory.
     $files = DataList::create($baseClass)->filter('ParentID', $folderID);
     $fileField = new GridField('Files', false, $files, $config);
     $fileField->setAttribute('data-selectable', true);
     if ($this->parent->getAllowedMaxFileNumber() !== 1) {
         $fileField->setAttribute('data-multiselect', true);
     }
     $selectComposite = new CompositeField($folderField, $fileField);
     return $selectComposite;
 }
开发者ID:hemant-chakka,项目名称:awss,代码行数:28,代码来源:UploadField.php

示例3: getRelationAutosetClass

 /**
  * Gets the foreign class that needs to be created, or 'S3File' as default if there is no relationship, or it cannot be determined.
  * @param string $default
  */
 public function getRelationAutosetClass($default = 'S3File')
 {
     return parent::getRelationAutosetClass($default);
 }
开发者ID:firebrandhq,项目名称:s3fileupload,代码行数:8,代码来源:S3FileUploadField.php

示例4: getListField

 /**
  * @param $folderID The ID of the folder to display.
  * @return FormField
  */
 protected function getListField($folderID)
 {
     // Generate the folder selection field.
     $folderField = new TreeDropdownField('ParentID', _t('HtmlEditorField.FOLDER', 'Folder'), 'Folder');
     $folderField->setValue($folderID);
     // Generate the file list field.
     $config = GridFieldConfig::create();
     $config->addComponent(new GridFieldSortableHeader());
     $config->addComponent(new GridFieldFilterHeader());
     $config->addComponent(new GridFieldDataColumns());
     $config->addComponent(new GridFieldPaginator(10));
     // If relation is to be autoset, we need to make sure we only list compatible objects.
     $baseClass = null;
     if ($this->parent->relationAutoSetting) {
         $baseClass = $this->parent->getRelationAutosetClass();
     }
     // By default we can attach anything that is a file, or derives from file.
     if (!$baseClass) {
         $baseClass = 'File';
     }
     // Create the data source for the list of files within the current directory.
     $files = DataList::create($baseClass)->filter('ParentID', $folderID);
     $fileField = new GridField('Files', false, $files, $config);
     $fileField->setAttribute('data-selectable', true);
     if ($this->parent->getConfig('allowedMaxFileNumber') > 1) {
         $fileField->setAttribute('data-multiselect', true);
     }
     $selectComposite = new CompositeField($folderField, $fileField);
     return $selectComposite;
 }
开发者ID:prostart,项目名称:cobblestonepath,代码行数:34,代码来源:UploadField.php

示例5: getListField

	/**
	 * @param $folderID The ID of the folder to display.
	 * @return FormField
	 */
	protected function getListField($folderID) {
		// Generate the folder selection field.
		$folderField = new TreeDropdownField('ParentID', _t('HtmlEditorField.FOLDER', 'Folder'), 'Folder');
		$folderField->setValue($folderID);

		// Generate the file list field.
		$config = GridFieldConfig::create();
		$config->addComponent(new GridFieldSortableHeader());
		$config->addComponent(new GridFieldFilterHeader());
		$config->addComponent(new GridFieldDataColumns());
		$config->addComponent(new GridFieldPaginator(10));

		// Create the data source for the list of files within the current directory.
		$files = DataList::create('File')->filter('ParentID', $folderID);

		// If relation is to be autoset, make sure only objects from related class are listed.
		if ($this->parent->relationAutoSetting) {
			if ($relationClass = $this->parent->getRelationAutosetClass()) {
				$files->filter('ClassName', $relationClass);
			}
		}

		$fileField = new GridField('Files', false, $files, $config);
		$fileField->setAttribute('data-selectable', true);
		if($this->parent->getConfig('allowedMaxFileNumber') > 1) $fileField->setAttribute('data-multiselect', true);

		$selectComposite = new CompositeField(
			$folderField,
			$fileField
		);

		return $selectComposite;
	}
开发者ID:redema,项目名称:sapphire,代码行数:37,代码来源:UploadField.php

示例6: getListField

 /**
  * @param int $folderID The ID of the folder to display.
  * @return FormField
  */
 protected function getListField($folderID)
 {
     // Generate the folder selection field.
     $folderField = new TreeDropdownField('ParentID', _t('HTMLEditorField.FOLDER', 'Folder'), 'Folder');
     $folderField->setValue($folderID);
     // Generate the file list field.
     $config = GridFieldConfig::create();
     $config->addComponent(new GridFieldSortableHeader());
     $config->addComponent(new GridFieldFilterHeader());
     $config->addComponent($colsComponent = new GridFieldDataColumns());
     $colsComponent->setDisplayFields(array('StripThumbnail' => '', 'Title' => singleton('File')->fieldLabel('Title'), 'Created' => singleton('File')->fieldLabel('Created'), 'Size' => singleton('File')->fieldLabel('Size')));
     $colsComponent->setFieldCasting(array('Created' => 'DBDatetime->Nice'));
     // Set configurable pagination for file list field
     $pageSize = Config::inst()->get(get_class($this), 'page_size');
     $config->addComponent(new GridFieldPaginator($pageSize));
     // If relation is to be autoset, we need to make sure we only list compatible objects.
     $baseClass = $this->parent->getRelationAutosetClass();
     // Create the data source for the list of files within the current directory.
     $files = DataList::create($baseClass)->exclude('ClassName', 'Folder');
     if ($folderID) {
         $files = $files->filter('ParentID', $folderID);
     }
     $fileField = new GridField('Files', false, $files, $config);
     $fileField->setAttribute('data-selectable', true);
     if ($this->parent->getAllowedMaxFileNumber() !== 1) {
         $fileField->setAttribute('data-multiselect', true);
     }
     $selectComposite = new CompositeField($folderField, $fileField);
     return $selectComposite;
 }
开发者ID:jacobbuck,项目名称:silverstripe-framework,代码行数:34,代码来源:UploadField.php

示例7: getRelationAutosetClass

 /**
  * @param string $default
  * @return string
  */
 public function getRelationAutosetClass($default = 'CloudinaryFile')
 {
     if (!$this->relationAutoSetting) {
         return $default;
     }
     return parent::getRelationAutosetClass($default);
 }
开发者ID:helpfulrobot,项目名称:mademedia-silverstripe-cloudinary,代码行数:11,代码来源:CloudinaryUploadField.php


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