BastianBalthasarBux / tt_address

Add address / contact datasets to your content management system.
GNU General Public License v2.0
4 stars 2 forks source link

output of custom tt_address field content #7

Closed heikohaensge closed 6 years ago

heikohaensge commented 6 years ago

I added an additional field to tt_address table: tx_ttaddressrtefield_rtecontent This field is configured to appear as RTE field in Typo3 backend.

The output in the fluid partial template AddressItemDetail.html looks like this:

<f:if condition="{address.tx_ttaddressrtefield_rtecontent}">
  <f:then>
      <f:format.html>{address.tx_ttaddressrtefield_rtecontent}</f:format.html>
  </f:then>
</f:if>

But... there is no output generated. How to output custom field content?

BastianBalthasarBux commented 6 years ago

Are you sure, the correct partial is loaded? (@see your issue #6 ) Did you add the field also to Domain Model with getter and setter correctly?

I do nothing special in the controlerAction of detail view. You should be able to add your own fields like with any other Extbase/Fluid extensions. Which basically means: Add your field to the DomainModel and to the partial.

heikohaensge commented 6 years ago

Thanks for you reply. the corect partial is loaded; since the partial template override didn't work I simply edited the partials directly in tt_address - which of course works.

I'm not sure if the field is added to the DomainModel. The field is added via a custom extension. Where and what do I have to look for this?

BastianBalthasarBux commented 6 years ago

"Abstract" short explanation via Extensionbuilder https://docs.typo3.org/typo3cms/extensions/extension_builder/Developer/ExtendingModels.html

This one is for fe_users, but i am pretty sure, it is a valid example also for tt_address, as soon as it comes to extend preexisting extbase domain models: https://docs.typo3.org/typo3cms/extensions/femanager/1.0.11/ExtfeManager/BestPractice/AddingNewFieldsToFeUsersWithYourOwnExtension/Index.html

And this one is IMHO an excellent summarization on the tx_news example: http://www.lukasjakob.com/extend-a-typo3-extbase-model-with-custom-field/

Very important: extending the model with your own model, something like that (pseudocode!! and therefore not code-tagged):

class myNewExtendingTtAddressExtension extends TtAddressDomainModel { ... }

heikohaensge commented 6 years ago

Vielen Dank für die Hinweise. Dies scheint allerdings meine Fähigkeiten bzgl. Ext.-Programmierung zu übersteigen... :-/ Ich hab's so versucht: Die tt_address-Tabelle wurde erfolgreich mit einer Extension 'ttaddress_rtefield' erweitert um das Feld 'tx_ttaddressrtefield_rtecontent'. Um das Domain-Model zu erweitern, hab ich eine Datei '/typo3conf/ext/ttaddress_rtefield/Classes/Domain/Model/TtaddressRtefield.php angelegt mit folgendem Inhalt (für den Upload hier umbenannt zu TtaddressRtefield.txt:

TtaddressRtefield.txt

Im Template 'AddressItemDetail.html' erhalte ich weder für

{address.tx_ttaddressrtefield_rtecontent} noch für {address.TxTtaddressrtefieldRtecontent} eine Ausgabe.

Bin ich grundsätzlich auf dem richtigen Weg, oder komplett daneben? Ich akzeptiere auch gern bezahlten Support.

BastianBalthasarBux commented 6 years ago

Grundsätzlich passt das. ABER: das hier: namespace FrFr\ttaddress_rtefield\Domain\Model; in Verbindung mit dem hier: class TtaddressRtefield extends TtAddressDomainModel { ohne eine "use" zeile, wird vermutlich nicht hinhauen. Wundert mich, dass da nix meckert, von wegen TtAddressDomainModel not found.

Probier doch mal so: class TtaddressRtefield extends \TYPO3\TtAddress\Domain\Model\Address {

heikohaensge commented 6 years ago

Vielen Dank für die Hilfestellung. Die Angabe: class myNewExtendingTtAddressExtension extends TtAddressDomainModel { hatte ich aufgrund deines Hinweises oben so eingefügt. Aber auch class TtaddressRtefield extends \TYPO3\TtAddress\Domain\Model\Address { liefert keine Frontendausgabe. Ich leg mal die Extension anbei. Falls sie mal funktionieren sollte, kann sie gern als Beispiel zur Erweiterung von tt_address 4.0 verwendet werden. ttaddress_rtefield_7.6.0_20171113.zip

BastianBalthasarBux commented 6 years ago

--> ich schrieb ja oben: pseudocode. den objektpfad zum Model hättest halt schon korrekt einfügen müssen. hab ich mich vielleicht zu unklar ausgedrückt. ;) ich schau mir deine ext bei nächster gelegenheit an. aber sicher nicht in den nächsten 10 tagen, da komm ich leider einfach nicht dazu. liegt aber sicher nur an einer kleinigkeit. ...

heikohaensge commented 6 years ago

Danke, ja, das wär prima! Wenn's dann funktioniert, hätte es gleich ein anschauliches Beispiel für die Erweiterung von tt_address für's Manual.

heikohaensge commented 6 years ago

Noch eine Idee: im TS-Setup hab ich noch nichts gemappt. Vll. liegt's daran. Allerdings wüßte ich nicht, was da rein sollte.

heikohaensge commented 6 years ago

Jetzt hab ich mal noch versucht, das TS-setup-Mapping umzusetzen. Leider immer noch ohne Erfolg, was die Ausgabe im Frontend betrifft. Anbei die aktuelle Version der Extension: ttaddress_rtefield_7.6.0_20171113.zip

heikohaensge commented 6 years ago

Vielen Dank an meine Kollegin Elena! Sie hat gestern Nacht meinen stümperhaften Versuch noch gerade gerückt und auch gleich veröffentlicht: https://github.com/kuprienko/ttaddress_rtefield Hab's gerade getestet. Es funktioniert prima!

BastianBalthasarBux commented 6 years ago

Sieht gut aus soweit. Nur noch ein Tipp: das was in der ext_tables.php steht, gehört vermutlich eigentlich in Configuration/TCA/Overrides/tt_address.php Und die Inhalte von der localconf.php gehören da IMHO auch nicht hin, sondern eher in Configuration/TCA/Overrides/sys_template.php Das wären die neuen Konventionen.

Da es sich aber insgesamt hier um ein "Anwenderproblem" handelt, werde ich das issue schliessen.