Project

General

Profile

Actions

Feature #66620

closed

FE Edit viewhelper

Added by Philipp Wrann about 9 years ago. Updated about 7 years ago.

Status:
Closed
Priority:
Could have
Assignee:
-
Category:
Frontend
Target version:
-
Start date:
2015-04-28
Due date:
% Done:

0%

Estimated time:
PHP Version:
5.5
Tags:
Complexity:
Sprint Focus:

Description

I wrote a viewhelper for fe edit, it would be nice to have some kind of this functionallity in the core.
I dont know the typo3 coding guidelines and didnt work with gerrit before, so i thought i share those lines here.

Also i didnt know how to get the raw query result from the persistence manager to avoid the query...

<?php

namespace TYPO3\CMS\Feedit\ViewHelpers;

use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Database\DatabaseConnection;
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;

/**
 * @author Philipp Wrann <philippwrann@gmail.com>
 * @package TYPO3.CMS
 * @subpackage Feedit
 */
class EditPanelViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper {

    /**
     * @var ContentObjectRenderer
     */
    protected static $contentObjectRenderer = NULL;

    /**
     * @var \TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface
     * @inject
     */
    protected $configurationManager;

    /**
     * @param \TYPO3\CMS\Extbase\DomainObject\AbstractEntity $for
     * @return string
     */
    public function render(AbstractEntity $for) {
        if ($GLOBALS['TSFE']->beUserLogin) {
            $settings = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK,$this->controllerContext->getRequest()->getControllerExtensionName());
            $config = $settings['admPanel'];
            $table = $settings['persistence']['classes'][get_class($for)]['mapping']['tableName'];
            $currentRecord = $table.':'.$for->getUid();
            $dataArray = $this->getDatabase()->exec_SELECTgetSingleRow('*',$table,'uid='.$for->getUid());
            return self::getContentObjectRenderer()->editPanel('', $config, $currentRecord, $dataArray);
        }
    }

    /**
     * @return ContentObjectRenderer
     */
    protected static function getContentObjectRenderer() {
        if (self::$contentObjectRenderer === NULL) {
            self::$contentObjectRenderer = GeneralUtility::makeInstance(ContentObjectRenderer::class); 
        }
        return self::$contentObjectRenderer;
    }

    /**
     * @return DatabaseConnection
     */
    protected function getDatabase() {
        return $GLOBALS['TYPO3_DB'];
    }

}

So basically you have to add the admPanel configuration to your extensions typoscript and place this viewHelper:
<feedit:editPanel for="{yourEntity}"/>

It is very limited that way but would be a start :)


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Feature #79633: Integrate next generation of Frontend Editing based on CKEditorRejectedBenni Mack2017-02-10

Actions
Actions #1

Updated by Benni Mack almost 9 years ago

  • Target version changed from 7.2 (Frontend) to 7.4 (Backend)
Actions #2

Updated by Susanne Moog almost 9 years ago

  • Target version changed from 7.4 (Backend) to 7.5
Actions #3

Updated by Claus Due over 8 years ago

  • Status changed from New to Accepted

Recommended location for this ViewHelper is as part of the system extension "feedit"; using standard ViewHelper approach. Aside from needing a bit of dusting off which we can do during review, I'd say "go ahead and create a merge request" ;)

Actions #4

Updated by Benni Mack over 8 years ago

  • Target version changed from 7.5 to 7 LTS
Actions #5

Updated by Gerrit Code Review over 8 years ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/44086

Actions #6

Updated by Gerrit Code Review over 8 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/44086

Actions #7

Updated by Gerrit Code Review over 8 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/44086

Actions #8

Updated by Gerrit Code Review over 8 years ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/44086

Actions #9

Updated by Morton Jonuschat over 8 years ago

  • Target version deleted (7 LTS)
Actions #10

Updated by Wouter Wolters over 7 years ago

  • Status changed from Under Review to New

Patch was abandoned in February 2016

Actions #11

Updated by Riccardo De Contardi about 7 years ago

  • Related to Feature #79633: Integrate next generation of Frontend Editing based on CKEditor added
Actions #12

Updated by Riccardo De Contardi about 7 years ago

  • Status changed from New to Closed

I guess that this can be safely closed (next-gen frontend editing feature is now under development).

If you think that this is the wrong decision please reopen it or open a new issue with a reference to this one. Thank you!

Actions

Also available in: Atom PDF