Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

output of custom tt_address field content #7

Closed
heikohaensge opened this issue Nov 8, 2017 · 12 comments
Closed

output of custom tt_address field content #7

heikohaensge opened this issue Nov 8, 2017 · 12 comments
Assignees
Labels

Comments

@heikohaensge
Copy link

heikohaensge commented Nov 8, 2017

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
Copy link
Owner

BastianBalthasarBux commented Nov 9, 2017

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
Copy link
Author

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
Copy link
Owner

BastianBalthasarBux commented Nov 10, 2017

"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
Copy link
Author

heikohaensge commented Nov 13, 2017

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

<f:format.html>{address.tx_ttaddressrtefield_rtecontent}</f:format.html>
noch für
<f:format.html>{address.TxTtaddressrtefieldRtecontent}</f:format.html>
eine Ausgabe.

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

@BastianBalthasarBux
Copy link
Owner

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
Copy link
Author

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
Copy link
Owner

--> 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
Copy link
Author

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
Copy link
Author

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
Copy link
Author

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
Copy link
Author

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
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants