-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BUGFIX] Fix If ViewHelper for edit / delete buttons
- Loading branch information
Showing
2 changed files
with
7 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,16 +17,14 @@ | |
|
||
use Dan\Jobfair\Domain\Model\Job; | ||
use Dan\Jobfair\Service\AccessControlService; | ||
use TYPO3Fluid\Fluid\Core\Compiler\TemplateCompiler; | ||
use TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\ViewHelperNode; | ||
use TYPO3Fluid\Fluid\ViewHelpers\IfViewHelper; | ||
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractConditionViewHelper; | ||
|
||
/** | ||
* View helper to create additional parameters for link to user profile | ||
* | ||
* @author Dan <[email protected]> | ||
*/ | ||
class EditLinkViewHelper extends IfViewHelper | ||
class EditLinkViewHelper extends AbstractConditionViewHelper | ||
{ | ||
|
||
/** | ||
|
@@ -55,39 +53,10 @@ public function initializeArguments() | |
*/ | ||
public function render() | ||
{ | ||
//\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($this->arguments['job']); | ||
$job = $this->arguments['job']; | ||
if ($this->accessControlService->isOwner($job)) { | ||
return $this->renderThenChild(); | ||
} | ||
return $this->renderElseChild(); | ||
} | ||
|
||
/** | ||
* The compiled ViewHelper adds two new ViewHelper arguments: __thenClosure and __elseClosure. | ||
* These contain closures which are be executed to render the then(), respectively else() case. | ||
* | ||
* @param string $argumentsName | ||
* @param string $closureName | ||
* @param string $initializationPhpCode | ||
* @param ViewHelperNode $node | ||
* @param TemplateCompiler $compiler | ||
* @return string | ||
*/ | ||
public function compile( | ||
$argumentsName, | ||
$closureName, | ||
&$initializationPhpCode, | ||
ViewHelperNode $node, | ||
TemplateCompiler $compiler | ||
) { | ||
parent::compile( | ||
$argumentsName, | ||
$closureName, | ||
$initializationPhpCode, | ||
$node, | ||
$compiler | ||
); | ||
return TemplateCompiler::SHOULD_GENERATE_VIEWHELPER_INVOCATION; | ||
} | ||
} |