Da ich keine Antwort im forum.typo3.org ([url]http://forum.typo3.org/index.php/m/728496/#msg_728496[/url]) erhalten habe, als Cross-Post nochmal. Sorry, ich komme allein nicht weiter.
[b]Kurzfassung:[/b]
Ich habe in TYPO3 6.2.9 per Extension Builder und manuell eine Erweiterung erstellt, um nn_address von Hendrik Reimers ([url]http://docs.typo3.org/typo3cms/extensions/nn_address/[/url]) um eigene Felder zu erweitern. Die Fluid-Ausgabe ist jedoch leer.
- Die Felder werden in der Tabelle tx_nnaddress_domain_model_person angelegt (zusätzlich ein Feld tx_extbase_type).
- Im Backend erscheinen die Felder an der gewünschten Stelle. Ich kann Text eintragen und speichern. Die Inhalte sind in der Datenbank enthalten.
- Das Problem: In der Personen-Ausgabe von NN Address (/typo3conf/ext/nn_address/Resources/Private/Partials/Person/Properties.html, muss ich dann noch updatesicher in meine Extension umbiegen) setze ich die Variable {person.myfield1} zur Ausgabe mit dem neuen Feldnamen, aber im Frontend erscheint nichts
<f:debug>{person.myfield1}</f:debug> ergibt "NULL", der Inhalt der Condition in Fluid (s. u.) wird nicht ausgeführt.
Ich bin diverse Foren-Einträge und Tutorials zur Erstellung von Extensions durchgegangen (habe dabei sicherlich nicht alles verstanden), habe nach Fehlermeldungen gesucht, Caches gelöscht, die Erweiterung nochmal installiert/deinstalliert und mehrfach ein Compare im Install-Tool durchgeführt, hänge jetzt aber fest und weiß nicht, warum es keine Ausgabe gibt bzw. welche Voraussetzungen die Fluid-Ausgabe benötigt oder wie NN Address hier funktioniert.
Ich habe keine wirklichen PHP-Kenntnisse und noch keine "richtige" eigene Extension geschrieben. tt_address konnte ich unter 4.5 aber einfach um Felder erweitern.
Mir ist bekannt, dass man NN Address sehr einfach über eine Flexform um Felder erweitern kann, möchte aber, dass die neuen Felder alle im Reiter "Allgemein" erscheinen und nicht im Reiter "Erweitert" (und zudem am Beispiel lernen, wie ich Felder einer bestehenden Extension erweitere).
Hat jemand eine Idee? Wie sollte ich mein Problem anpacken?
Oder sollte ich als Voraussetzung erst einmal weiter Extensions schreiben lernen und PHP lernen?
Danke für's Reinschauen.
Hier hoffentlich relevante Codeausschnitte (sende gern mehr):
/typo3conf/ext/nn_address/Resources/Private/Partials/Person/Properties.html:
<tr> <td> <f:translate key="tx_nnaddress_domain_model_person.myfield1" /> </td> <td> {person.myfield1} </td> </tr> </f:if>
/typo3conf/ext/my_ext1/ext_tables.php
<?php } \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin( $_EXTKEY, 'Myext1', 'NN Address new fields' ); \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile($_EXTKEY, 'Configuration/TypoScript', 'NN Address new fields'); 'exclude' => 1, 'label' => 'LLL:EXT:my_ext1/Resources/Private/Language/de.locallang_db.xlf:tx_nnaddress_domain_model_person.myfield1', 'type' => 'text', 'cols' => '40', 'rows' => '5', '_PADDING' => 2, 'icon' => 'wizard_rte2.gif', 'notNewRecords' => 1, 'RTEonly' => 1, 'script' => 'wizard_rte.php', 'title' => 'LLL:EXT:cms/locallang_ttc.xlf:bodytext.W.RTE', 'type' => 'script', ), ), ) ), ); \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('tx_nnaddress_domain_model_person',$tempColumns,1); \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes('tx_nnaddress_domain_model_person','myfield1','','after:last_name'); $TCA['tx_nnaddress_domain_model_person']['interface']['showRecordFieldList'] .= ',myfield1'; \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::makeCategorizable( $_EXTKEY, 'tx_nnaddress_domain_model_person' );
/typo3conf/ext/my_ext1/ext_tables.sql:
# # Table structure for table 'tx_nnaddress_domain_model_person' # CREATE TABLE tx_nnaddress_domain_model_person ( myfield1 tinytext NOT NULL, tx_extbase_type varchar(255) DEFAULT '' NOT NULL, ); # # Table structure for table 'tx_nnaddress_domain_model_person' # CREATE TABLE tx_nnaddress_domain_model_person ( categories int(11) unsigned DEFAULT '0' NOT NULL, );
/typo3conf/ext/my_ext1/ext_typoscript_setup.txt:
config.tx_extbase{ persistence{ classes{ TYPO3\CMS\Extbase\DomainObject\AbstractEntity { subclasses { Tx_Myext1_Person = My\MyExt1\Domain\Model\Person } } My\MyExt1\Domain\Model\Person { mapping { tableName = tx_nnaddress_domain_model_person #recordType = Tx_Myext1_Person } } } } }
/typo3conf/ext/my_ext1/Classes/Domain/Model/Person.php:
<?php namespace My\MyExt1\Domain\Model; /** * Person */ class Person extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity { /** * myfield1 * * @var string */ protected $myfield1 = ''; /** * Returns the myfield1 * * @return string $myfield1 */ public function getMyfield1() { return $this->myfield1; } /** * Sets the myfield1 * * @param string $myfield1 * @return void */ public function setMyfield1($myfield1) { $this->myfield1 = $myfield1; } ...
/typo3conf/ext/my_ext1/Classes/Domain/Repository/PersonRepository.php
<?php namespace My\MyExt1\Domain\Repository; /** * The repository for Person */ class PersonRepository extends \TYPO3\CMS\Extbase\Persistence\Repository { }