-
Notifications
You must be signed in to change notification settings - Fork 233
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
[TASK] Cleanups in FalViewHelper #962
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
*/ | ||
|
||
use FluidTYPO3\Vhs\Utility\ResourceUtility; | ||
use TYPO3\CMS\Core\Resource\FileReference; | ||
use TYPO3\CMS\Core\Utility\ArrayUtility; | ||
use TYPO3\CMS\Core\Utility\GeneralUtility; | ||
use TYPO3\CMS\Core\Database\DatabaseConnection; | ||
|
@@ -62,8 +63,8 @@ public function __construct() { | |
} | ||
|
||
/** | ||
* @param mixed $identity | ||
* @return mixed | ||
* @param FileReference $fileReference | ||
* @return array | ||
*/ | ||
public function getResource($fileReference) { | ||
$file = $fileReference->getOriginalFile(); | ||
|
@@ -74,11 +75,11 @@ public function getResource($fileReference) { | |
} | ||
|
||
/** | ||
* Fetch a fileRefernce from the file repository | ||
* Fetch a fileReference from the file repository | ||
* | ||
* @param $table name of the table to get the file reference for | ||
* @param $field name of the field referencing a file | ||
* @param $uid uid of the related record | ||
* @param string $table name of the table to get the file reference for | ||
* @param string $field name of the field referencing a file | ||
* @param int $uid uid of the related record | ||
* @return array | ||
*/ | ||
protected function getFileReferences($table, $field, $uid) { | ||
|
@@ -91,19 +92,15 @@ protected function getFileReferences($table, $field, $uid) { | |
* @return array | ||
*/ | ||
public function getResources($record) { | ||
/** @var \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer $contentObj */ | ||
$contentObjectRenderer = $this->configurationManager->getContentObject(); | ||
|
||
/** @var \TYPO3\CMS\Core\Database\DatabaseConnection $databaseConnection */ | ||
$databaseConnection = $this->getDatabaseConntection(); | ||
|
||
if (isset($record['t3ver_oid']) && (integer) $record['t3ver_oid'] !== 0) { | ||
$sqlRecordUid = $record['t3ver_oid']; | ||
} else { | ||
$sqlRecordUid = $record[$this->idField]; | ||
} | ||
|
||
if (FALSE === empty($GLOBALS['TSFE']->sys_page)) { | ||
$images = array(); | ||
if (empty($GLOBALS['TSFE']->sys_page) === FALSE) { | ||
$images = $this->getFileReferences($this->getTable(), $this->getField(), $sqlRecordUid); | ||
} else { | ||
if ($GLOBALS['BE_USER']->workspaceRec['uid']) { | ||
|
@@ -123,19 +120,19 @@ public function getResources($record) { | |
'', | ||
'uid' | ||
); | ||
if (FALSE === empty($references)) { | ||
if (empty($references) === FALSE) { | ||
$referenceUids = array_keys($references); | ||
} | ||
$images = array(); | ||
if (FALSE === empty($referenceUids)) { | ||
foreach ($referenceUids as $referenceUid) { | ||
try { | ||
// Just passing the reference uid, the factory is doing workspace | ||
// overlays automatically depending on the current environment | ||
$images[] = $this->resourceFactory->getFileReferenceObject($referenceUid); | ||
} catch (ResourceDoesNotExistException $exception) { | ||
// No handling, just omit the invalid reference uid | ||
continue; | ||
$images = array(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
if (empty($referenceUids) === FALSE) { | ||
foreach ($referenceUids as $referenceUid) { | ||
try { | ||
// Just passing the reference uid, the factory is doing workspace | ||
// overlays automatically depending on the current environment | ||
$images[] = $this->resourceFactory->getFileReferenceObject($referenceUid); | ||
} catch (ResourceDoesNotExistException $exception) { | ||
// No handling, just omit the invalid reference uid | ||
continue; | ||
} | ||
} | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use
integer
here - everything else looks good!