TYPO3新闻记录前端编辑(分机:前端编辑)

TYPO3新闻记录前端编辑(分机:前端编辑),typo3,tx-news,Typo3,Tx News,我正在尝试为新闻记录(ext:news)激活新的前端编辑(ext:frontend_editing)。编辑部分运行良好,但我未能在前端添加新的新闻记录 我正在按照中的步骤进行操作,此时会出现“自定义记录”部分,但现在该怎么办?有人能描述一下我需要传递给方法wrapContentWithDropzone()的值吗?该方法在手册中有描述 /** * @param string $content Empty string (no content to process) * @param array

我正在尝试为新闻记录(ext:news)激活新的前端编辑(ext:frontend_editing)。编辑部分运行良好,但我未能在前端添加新的新闻记录

我正在按照中的步骤进行操作,此时会出现“自定义记录”部分,但现在该怎么办?有人能描述一下我需要传递给方法wrapContentWithDropzone()的值吗?该方法在手册中有描述

/**
 * @param string $content Empty string (no content to process)
 * @param array $conf TypoScript configuration
 * @return string $content
 */
 public function wrapWithDropZone($content, $conf)
 {
      if (GeneralUtility::_GET('frontend_editing') && GeneralUtility::makeInstance(AccessService::class)->isEnabled()) {
           $wrapperService = GeneralUtility::makeInstance(ContentEditableWrapperService::class);

           $content = $wrapperService->wrapContentWithDropzone(
                'tt_content', // table name
                0, // page uid, pid
                $content,
                0 // colPos
           );
      }

      return $content;
 }
感谢任何帮助或推动正确的方向!谢谢

更新

我意识到,上面的代码在页面的最底部添加了一个放置区。但是这个放置区域只对“普通”内容元素起作用,而不对我新添加的自定义元素起作用。 当我将方法“wrapContentWithDropzone()”的第一个值更改为“tx_news_domain_model_news”时,无论删除了哪个元素,该删除区域都将创建新的新闻记录


因此,我仍在寻找一种方法,激活自定义记录,以便最好在存储文件夹中添加新的新闻记录

经过一些调试,我自己找到了答案:

不要使用方法“wrapContentWithDropzone()”而是“wrapContentWithCustomDropzone()”

这是我的密码:

打字稿:

plugin.tx_frontendediting {
    customRecords {
        10 {
            table = tx_news_domain_model_news
            pid = 6
        }
    }
}

page = PAGE
page.1001 = USER
page.1001 {
    userFunc = Vendor\Extension\UserFunc\FrontendEditing->addNewsDropZone
}
用户功能:

<?php
namespace Vendor\Extension\UserFunc;

use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\FrontendEditing\Service\AccessService;
use TYPO3\CMS\FrontendEditing\Service\ContentEditableWrapperService;

class FrontendEditing {

    /**
     * @param string $content Empty string (no content to process)
     * @param array $conf TypoScript configuration
     * @return string $content
     */
    public function addNewsDropZone($content, $conf)
    {
        if (GeneralUtility::_GET('frontend_editing') && GeneralUtility::makeInstance(AccessService::class)->isEnabled()) {
            $wrapperService = GeneralUtility::makeInstance(ContentEditableWrapperService::class);

            $content = $wrapperService->wrapContentWithCustomDropzone(
                'tx_news_domain_model_news', // table name of the record you want to create
                $content,
                // additional fields if needed
                [
                    //'title' => 'default title'
                ],
                6 // page uid of the page where you want to store the news records
            );
        }

        return $content;
     }
}

您可以在模板中的任何位置使用此选项:

<core:customDropZone tables="{0:'tx_news_domain_model_news'}" pageUid="{settings.startingpoint}"></core:customDropZone>

你是绝对正确的,同时这很容易,这是正确的答案。谢谢
plugin.tx_frontendediting{
    customRecords {
        10 {
            table = tx_news_domain_model_news
            pid = 142,154
        }
    }
}