-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BUGFIX] Fix Bug #72776 Links to record edit module do not work in TY…
…PO3 CMS 7 LTS
- Loading branch information
1 parent
6e29a9d
commit 5b1ada7
Showing
6 changed files
with
144 additions
and
49 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
<?php | ||
namespace DL\Yag\ViewHelpers\Backend; | ||
|
||
/*************************************************************** | ||
* Copyright notice | ||
* | ||
* (c) 2015 Daniel Lienert | ||
* | ||
* All rights reserved | ||
* | ||
* This script is part of the TYPO3 project. The TYPO3 project is | ||
* free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* The GNU General Public License can be found at | ||
* http://www.gnu.org/copyleft/gpl.html. | ||
* | ||
* This script is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* This copyright notice MUST APPEAR in all copies of the script! | ||
***************************************************************/ | ||
|
||
use TYPO3\CMS\Backend\Utility\BackendUtility; | ||
use TYPO3\CMS\Core\FormProtection\FormProtectionFactory; | ||
use TYPO3\CMS\Core\Utility\GeneralUtility; | ||
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity; | ||
use TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface; | ||
use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper; | ||
|
||
class EditRecordUrlViewHelper extends AbstractViewHelper | ||
{ | ||
|
||
/** | ||
* Returns a URL to record rditor | ||
* | ||
* @param AbstractEntity $entity to link to | ||
* @param string $returnUrl | ||
* @return string link to record editor | ||
*/ | ||
public function render(AbstractEntity $entity, $returnUrl) | ||
{ | ||
return static::renderStatic(['parameters' => $this->buildParameters($entity), 'returnUrl' => $returnUrl], | ||
$this->buildRenderChildrenClosure(), | ||
$this->renderingContext | ||
); | ||
} | ||
|
||
/** | ||
* @param array $arguments | ||
* @param \Closure $renderChildrenClosure | ||
* @param RenderingContextInterface $renderingContext | ||
* @return string | ||
*/ | ||
public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext) | ||
{ | ||
$parameters = GeneralUtility::explodeUrl2Array($arguments['parameters']); | ||
$parameters['returnUrl'] = $arguments['returnUrl']; | ||
|
||
return BackendUtility::getModuleUrl('record_edit', $parameters); | ||
} | ||
|
||
|
||
|
||
protected function buildParameters(AbstractEntity $entity) | ||
{ | ||
|
||
$className = get_class($entity); | ||
|
||
$classToTableMap = [ | ||
'Tx_Yag_Domain_Model_Gallery' => 'tx_yag_domain_model_gallery', | ||
'Tx_Yag_Domain_Model_Album' => 'tx_yag_domain_model_album', | ||
'Tx_Yag_Domain_Model_Item' => 'tx_yag_domain_model_item', | ||
]; | ||
|
||
$tableName = $classToTableMap[$className]; | ||
|
||
$parameters = sprintf('edit[%s][%s]=edit', $tableName, $entity->getUid()); | ||
|
||
return $parameters; | ||
} | ||
} |
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 |
---|---|---|
@@ -1,70 +1,73 @@ | ||
{namespace yag=Tx_Yag_ViewHelpers} | ||
{namespace yag=DL\Yag\ViewHelpers} | ||
{namespace ptx=Tx_PtExtbase_ViewHelpers} | ||
{namespace extlist=Tx_PtExtlist_ViewHelpers} | ||
{namespace core=TYPO3\CMS\Core\ViewHelpers} | ||
|
||
<div class="outer-wrapper"> | ||
<label for="tx-yag-album-name" > | ||
<f:translate key="tx_yag_domain_model_album.name" /> <span class="required"><f:translate key="tx_yag_general.required" default="(required)"/></span> | ||
</label> | ||
<div class="outer-field-wrapper"> | ||
<div class="field-wrapper type-text"> | ||
<f:form.textfield property="name" id="tx-yag-album-name"/> | ||
</div> | ||
</div> | ||
<label for="tx-yag-album-name"> | ||
<f:translate key="tx_yag_domain_model_album.name"/> | ||
<span class="required"><f:translate key="tx_yag_general.required" default="(required)"/></span> | ||
</label> | ||
<div class="outer-field-wrapper"> | ||
<div class="field-wrapper type-text"> | ||
<f:form.textfield property="name" id="tx-yag-album-name"/> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
|
||
<div class="outer-wrapper"> | ||
<label for="tx-yag-album-galleries" > | ||
<f:translate key="tx_yag_domain_model_gallery" /> | ||
</label> | ||
<div class="outer-field-wrapper"> | ||
<div class="field-wrapper type-text"> | ||
<f:form.select id="tx-yag-album-galleries" property="gallery" options="{selectableGalleries}" optionValueField="uid" optionLabelField="name" value="{selectedGallery}" /> | ||
</div> | ||
</div> | ||
<label for="tx-yag-album-galleries"> | ||
<f:translate key="tx_yag_domain_model_gallery"/> | ||
</label> | ||
<div class="outer-field-wrapper"> | ||
<div class="field-wrapper type-text"> | ||
<f:form.select id="tx-yag-album-galleries" property="gallery" options="{selectableGalleries}" | ||
optionValueField="uid" optionLabelField="name" value="{selectedGallery}"/> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
|
||
<div class="outer-wrapper"> | ||
<label for="tx-yag-album-description" > | ||
<f:translate key="tx_yag_domain_model_album.description" /> | ||
<label for="tx-yag-album-description"> | ||
<f:translate key="tx_yag_domain_model_album.description"/> | ||
</label> | ||
<div class="outer-field-wrapper"> | ||
<div class="field-wrapper type-text"> | ||
<f:form.textarea id="tx-yag-album-description" property="description" cols="40" rows="15" /><br /> | ||
</div> | ||
</div> | ||
<div class="outer-field-wrapper"> | ||
<div class="field-wrapper type-text"> | ||
<f:form.textarea id="tx-yag-album-description" property="description" cols="40" rows="15"/> | ||
<br/> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="outer-wrapper"> | ||
<label for="tx-yag-album-date" > | ||
<f:translate key="tx_yag_domain_model_album.date" /> | ||
<label for="tx-yag-album-date"> | ||
<f:translate key="tx_yag_domain_model_album.date"/> | ||
</label> | ||
<div class="outer-field-wrapper"> | ||
<div class="field-wrapper type-text"> | ||
<div class="outer-field-wrapper"> | ||
<div class="field-wrapper type-text"> | ||
<f:form.textfield name="album[date][date]" value="{f:format.date(date:album.date)}" id="tx-yag-album-date"/> | ||
<f:form.hidden name="album[date][dateFormat]" value="{config.extensionConfig.sysDateFormat}"/> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="outer-wrapper"> | ||
<label for="tx-yag-album-hide" > | ||
<f:translate key="tx_yag_domain_model_album.hide" /> | ||
<label for="tx-yag-album-hide"> | ||
<f:translate key="tx_yag_domain_model_album.hide"/> | ||
</label> | ||
<div class="outer-field-wrapper"> | ||
<div class="field-wrapper type-text"> | ||
<f:form.checkbox id="tx-yag-album-hide" property="hidden" value="1" checked="{album.hidden}" /> | ||
</div> | ||
</div> | ||
<div class="outer-field-wrapper"> | ||
<div class="field-wrapper type-text"> | ||
<f:form.checkbox id="tx-yag-album-hide" property="hidden" value="1" checked="{album.hidden}"/> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="yag-albumedit-commands"> | ||
<a href="alt_doc.php?returnUrl={f:uri.action(action:'submitFilter', additionalParams:'{id:currentPid}', arguments:'{extlist:namespace.GPArray(object: yagContext arguments:\'albumUid:{album.uid}\')}')->ptx:format.urlencode()}&edit[tx_yag_domain_model_album][{album.uid}]=edit" > | ||
<core:icon identifier="actions-document-open" /> | ||
<f:translate key="tx_yag_controller_item.editAlbumInListModule"/> | ||
</a> | ||
<a href="{yag:Backend.editRecordUrl(entity:album, returnUrl: '{f:uri.action(action:\'submitFilter\', additionalParams:\'{id:currentPid}\', arguments:\'{extlist:namespace.GPArray(object: yagContext arguments:\\'albumUid:{album.uid}\\')}\')}')}"> | ||
<core:icon identifier="actions-document-open"/> | ||
<f:translate key="tx_yag_controller_item.editAlbumInListModule"/> | ||
</a> | ||
</div> | ||
|
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
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