I am trying to extend the news extension to include custom input fields. I've already created a domain model:
<?php
namespace PegasusWerbeagenturGmbh\NewsExtend\Domain\Model;
/**
* News model for default news
*
* @package TYPO3
* @subpackage tx_news
*/
class NewsExtend extends \GeorgRinger\News\Domain\Model\NewsDefault
{
/**
* @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;
}
}
and extened the structure of the database as below:
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
);
created the custom input fields in the backend (which works fine)
'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
',
],
and finally edited my setup.typoscript
plugin.tx_news {
persistence {
classes {
GeorgRinger\News\Domain\Model\NewsDefault {
subclasses {
0 = PegasusWerbeagenturGmbh\NewsExtend\Domain\Model\NewsExtend
}
}
PegasusWerbeagenturGmbh\NewsExtend\Domain\Model\NewsExtend {
mapping {
tableName = tx_news_domain_model_news
recordType = 0
}
}
}
}
}
I've spent hours trying to figure out why the custom input fields are not being renderd to the frontend, unfortunately without any success.
any help would be appreciated.
In TYPO3 v10 the configuration of Extbase persistence classes has changed:
Changelog
See also the examples in the news documentation: (you are currently following the "custom type" approach)
Note: the version selector in that documentation seems to be misleading - select "master" for TYPO3v10 + v11