TYPO3添加自定义输入字段的新闻扩展



我正在尝试扩展新闻扩展以包括自定义输入字段。我已经创建了一个域模型:

<?php

namespace PegasusWerbeagenturGmbhNewsExtendDomainModel;

/**
* News model for default news
*
* @package TYPO3
* @subpackage tx_news
*/
class NewsExtend extends GeorgRingerNewsDomainModelNewsDefault
{
/**
* @var string
*/
protected $address;

/**
* @var string
*/
protected $price;

/**
* @var int
*/
protected $roomNr;

/**
* @var int
*/
protected $bedNr;

/**
* @var int
*/
protected $bathroomNr;

/**
* Get address
*
* @return string
*/
public function getAdress()
{
return $this->address;
}

/**
* Set address
*
* @param string $address address
*/
public function setAdress($address)
{
$this->address = $address;
}


/**
* Get price
*
* @return string
*/
public function getPrice()
{
return $this->price;
}

/**
* Set price
*
* @param string $price price
*/
public function setPrice($price)
{
$this->price = $price;
}

/**
* Get roomNr
*
* @return int
*/
public function getRoomNr()
{
return $this->roomNr;
}

/**
* Set roomNr
*
* @param int $roomNr roomNr
*/
public function setRoomNr($roomNr)
{
$this->roomNr = $roomNr;
}

/**
* Get bedNr
*
* @return int
*/
public function getBedNr()
{
return $this->bedNr;
}

/**
* Set bedNr
*
* @param int $bedNr bedNr
*/
public function setBedNr($bedNr)
{
$this->bedNr = $bedNr;
}

/**
* Get bathroomNr
*
* @return int
*/
public function getBathroomNr()
{
return $this->bathroomNr;
}

/**
* Set bathroomNr
*
* @param int $bathroomNr bathroomNr
*/
public function setBathroomNr($bathroomNr)
{
$this->bathroomNr = $bathroomNr;
}

}

,并将数据库结构扩展如下:

CREATE TABLE tx_news_domain_model_news (
address varchar(255) DEFAULT '' NOT NULL,
price varchar(255) DEFAULT '' NOT NULL,
roomNr int(8) DEFAULT 0 NOT NULL,
bedNr int(8) DEFAULT 0 NOT NULL,
bathroomNr int(8) DEFAULT 0 NOT NULL
);

在后端创建了自定义输入字段(工作正常)

'address' => [
'exclude' => false,
'label' => 'Adresse',
'config' => [
'type' => 'input',
'size' => 30,
]
],
'price' => [
'exclude' => false,
'label' => 'Preis',
'config' => [
'type' => 'input',
'size' => 30,
]
],
'roomNr' => [
'exclude' => false,
'label' => 'Zimmer Anzahl',
'config' => [
'type' => 'input',
'size' => 30,
]
],
'bedNr' => [
'exclude' => false,
'label' => 'Betten Anzahl',
'config' => [
'type' => 'input',
'size' => 30,
]
],
'bathroomNr' => [
'exclude' => false,
'label' => 'Badezimmer Anzahl',
'config' => [
'type' => 'input',
'size' => 30,
]
],

'types' => [
// default news
'0' => [
'showitem' => '
--palette--;;paletteCore,title,--palette--;;paletteSlug,teaser,
--palette--;;paletteDate,
bodytext,
--palette--;;ApartmentDetails,
'ApartmentDetails' => [
'showitem' => '
address, price, roomNr, bedNr, bathroomNr
',
],

,最后编辑我的设置。typoscript

plugin.tx_news {
persistence {
classes {
GeorgRingerNewsDomainModelNewsDefault {
subclasses {
0 = PegasusWerbeagenturGmbhNewsExtendDomainModelNewsExtend
}
}
PegasusWerbeagenturGmbhNewsExtendDomainModelNewsExtend {
mapping {
tableName = tx_news_domain_model_news
recordType = 0
}
}
}
}
}

我花了几个小时试图弄清楚为什么自定义输入字段不被渲染到前端,不幸的是没有任何成功。

任何帮助都将是感激的。

在TYPO3 v10中,Extbase持久性类的配置发生了变化:

请参阅新闻文档中的示例:(您当前使用的是自定义类型"方法)

注意:文档中的版本选择器似乎是误导- select "master"for TYPO3v10 + v11

你能请提供确切的错误日志和你做哪些步骤完整的回溯与任何一个能帮助你


To add your extension typoscript to the list of selectable typoscript templates add the following to your EXT:news_extend/ext_tables.php
TYPO3CMSCoreUtilityExtensionManagementUtility::addStaticFile($_EXTKEY, 'Configuration/TypoScript', 'News Extend');

清除typo3temp,这将触发预期的结果,我希望没有缓存机制,如果-然后禁用它一段时间

相关内容

  • 没有找到相关文章

最新更新