Skip to content

Commit

Permalink
[TASK] Rename path argument to src
Browse files Browse the repository at this point in the history
This is a BC break but unifies image related view helper arguments
  • Loading branch information
bjo3rnf committed Jul 24, 2014
1 parent d69d571 commit 2305570
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions Classes/ViewHelpers/Media/Image/AbstractImageInfoViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function __construct() {
* @api
*/
public function initializeArguments() {
$this->registerArgument('path', 'string', 'Path to the image file to determine info for.', TRUE);
$this->registerArgument('src', 'string', 'Path to or id of the image file to determine info for.', TRUE);
$this->registerArgument('treatIdAsUid', 'boolean', 'If TRUE, the path argument is treated as a resource uid.', FALSE, FALSE);
$this->registerArgument('treatIdAsReference', 'boolean', 'If TRUE, the path argument is treated as a reference uid and will be resolved to a resource via sys_file_reference.', FALSE, FALSE);
}
Expand All @@ -63,27 +63,27 @@ public function initializeArguments() {
* @return array
*/
public function getInfo() {
$path = $this->arguments['path'];
$src = $this->arguments['src'];
$treatIdAsUid = (boolean) $this->arguments['treatIdAsUid'];
$treatIdAsReference = (boolean) $this->arguments['treatIdAsReference'];

if (NULL === $path) {
$path = $this->renderChildren();
if (NULL === $path) {
if (NULL === $src) {
$src = $this->renderChildren();
if (NULL === $src) {
return array();
}
}

if (TRUE === $treatIdAsUid || TRUE === $treatIdAsReference) {
$id = (integer) $path;
$id = (integer) $src;
$info = array();
if (TRUE === $treatIdAsUid) {
$info = $this->getInfoByUid($id);
} elseif (TRUE === $treatIdAsReference) {
$info = $this->getInfoByReference($id);
}
} else {
$file = GeneralUtility::getFileAbsFileName($path);
$file = GeneralUtility::getFileAbsFileName($src);
if (FALSE === file_exists($file) || TRUE === is_dir($file)) {
throw new Exception('Cannot determine info for "' . $file . '". File does not exist or is a directory.', 1357066532);
}
Expand Down

0 comments on commit 2305570

Please sign in to comment.