Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX] Replace internalType Argument by useFalRelation #1058

Merged
merged 1 commit into from
Jan 6, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 18 additions & 9 deletions Classes/Form/Field/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ class File extends AbstractMultiValueFormField {
protected $showThumbnails = FALSE;

/**
* @var string
* @var boolean
*/
protected $internalType = 'file';
protected $useFalRelation = FALSE;

/**
* @return array
Expand All @@ -54,9 +54,18 @@ public function buildConfiguration() {
$configuration['disallowed'] = $this->getDisallowed();
$configuration['allowed'] = $this->getAllowed();
$configuration['max_size'] = $this->getMaxSize();
$configuration['internal_type'] = $this->getInternalType();
$configuration['uploadfolder'] = $this->getUploadFolder();
$configuration['show_thumbs'] = $this->getShowThumbnails();
$configuration['internal_type'] = 'file';

if ($this->getUseFalRelation() === TRUE) {
$configuration['internal_type'] = 'db';
$configuration['allowed'] = 'sys_file';
$configuration['appearance'] = array(
'elementBrowserAllowed' => $this->getAllowed() ? $this->getAllowed() : '*',
'elementBrowserType' => 'file'
);
}
return $configuration;
}

Expand Down Expand Up @@ -165,19 +174,19 @@ public function getShowThumbnails() {
}

/**
* @param string $internalType
* @param boolean $useFalRelation
* @return File
*/
public function setInternalType($internalType) {
$this->internalType = $internalType;
public function setUseFalRelation($useFalRelation) {
$this->useFalRelation = $useFalRelation;
return $this;
}

/**
* @return string
* @return boolean
*/
public function getInternalType() {
return $this->internalType;
public function getUseFalRelation() {
return $this->useFalRelation;
}

}
4 changes: 2 additions & 2 deletions Classes/ViewHelpers/Field/FileViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function initializeArguments() {
$this->registerArgument('disallowed', 'string', 'Defines a list of file types NOT allowed in this field');
$this->registerArgument('uploadFolder', 'string', 'Upload folder. DEPRECATED, will be moved to the File field ViewHelper');
$this->registerArgument('showThumbnails', 'boolean', 'If TRUE, displays thumbnails for selected values', FALSE, FALSE);
$this->registerArgument('internalType', 'string', 'sets the internal type of this field', FALSE, 'file');
$this->registerArgument('useFalRelation', 'boolean', 'use a fal relation instead of a simple file path', FALSE, FALSE);
}

/**
Expand All @@ -54,7 +54,7 @@ public static function getComponent(RenderingContextInterface $renderingContext,
$component->setAllowed($arguments['allowed']);
$component->setUploadFolder($arguments['uploadFolder']);
$component->setShowThumbnails($arguments['showThumbnails']);
$component->setInternalType($arguments['internalType']);
$component->setUseFalRelation($arguments['useFalRelation']);
return $component;
}

Expand Down