BackendTemplates 

01.01.1970 1120

<?php
namespace Vendor\MyExtension\ViewHelpers\Backend;

/* * *************************************************************
 *  Copyright notice
 *
 *  (c) 2016 better code.com
 *  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 3 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\Utility\GeneralUtility;
use TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface;
use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper;
use TYPO3\CMS\Fluid\Core\ViewHelper\Facets\CompilableInterface;

/**
 * ViewHelper to create a link to edit a note
 * @internal
 */
class CreateLinkViewHelper extends AbstractViewHelper implements CompilableInterface
{
    /**
     * 
     * @param string $table
     * @param integer $storagePid
     * @return string
     */
    public function render($table, $storagePid)
    {
        return static::renderStatic(
            array(
                'table' => $table,
                'storagePid' => $storagePid
            ),
            $this->buildRenderChildrenClosure(),
            $this->renderingContext
        );
    }

    /**
     * @param array $arguments
     * @param callable $renderChildrenClosure
     * @param RenderingContextInterface $renderingContext
     *
     * @return string
     */
    public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
    {
        return BackendUtility::getModuleUrl(
            'record_edit',
            array(
                'edit[' . $arguments['table'] . '][' . $arguments['storagePid'] . ']' => 'new',
                'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')
            )
        );
    }
}
<?php
namespace Vendor\MyExtension\ViewHelpers\Backend;

/* * *************************************************************
 *  Copyright notice
 *
 *  (c) 2016 
 *  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 3 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\Utility\GeneralUtility;
use TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface;
use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper;
use TYPO3\CMS\Fluid\Core\ViewHelper\Facets\CompilableInterface;

/**
 * ViewHelper to create a link to edit a note
 * @internal
 */
class EditLinkViewHelper extends AbstractViewHelper implements CompilableInterface
{
    /**
     * @param int $id
     * @param tring $table
     * @return string
     */
    public function render($id, $table)
    {
        return static::renderStatic(
            array(
                'id' => $id,
                'table' => $table
            ),
            $this->buildRenderChildrenClosure(),
            $this->renderingContext
        );
    }

    /**
     * @param array $arguments
     * @param callable $renderChildrenClosure
     * @param RenderingContextInterface $renderingContext
     *
     * @return string
     */
    public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
    {
        return BackendUtility::getModuleUrl(
            'record_edit',
            array(
                'edit[' . $arguments['table'] . '][' . $arguments['id'] . ']' => 'edit',
                'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')
            )
        );
    }
}
{namespace myvh=Vendor\MyExtension\ViewHelpers\Backend}
{namespace core=TYPO3\CMS\Core\ViewHelpers}
<f:layout name="Backend" />

<f:section name="header">
    <div class="module-docheader-bar module-docheader-bar-navigation t3js-module-docheader-bar t3js-module-docheader-bar-navigation" ></div>
    <div class="module-docheader-bar-column-left">
        <div class="btn-toolbar" aria-label="" role="toolbar">
            <a href="{myvh:createLink(table:'tx_myextension_domain_model_table', storagePid:page.uid)}" >
                <core:icon identifier="actions-document-new" /> 
            </a>
        </div>
    </div>
    <div class="module-docheader-bar-column-right">
        
    </div>
</f:section>


<f:section name="content">
    <f:for each={bla} as="blub">
        <a href="{myvh:editLink(id:blub.uid, table:'tx_myextension_domain_model_blub')}" >
                {blub.title}
         </a>
    </f:for>
</f:section>