TYPO3: Upload files to FAL with powermail - typo3

I am using powermail to allow a FE-User to edit a couple of fields of his own User-Record. Works fine, no hassle.
Now I would also like to allow the upload of a file. Is there a way to save the file to FAL with powermail? Unfortunately I have found no resources on this whatsoever. Maybe it is possible to implement a userfunc when saving to DB that would generate the required DB entries? When using powermails "upload"-field-type the file gets written to uploads/tx_powermail. I have access to that files path in my db_entry step in typoscript and could pass it on to a userfunc - which in return should
generate the sys_file entry
delete a possiblibly already existing sys_file_reference
generate the new sys_file_reference
Am I missing something?
Any ideas on this? Has anyone done something like this before?
Or is my only alternative to switch from powermail to a custom extbase extension?
System: TYPO3 7.6.16, Powermail 3.17
Thanks

I have same problems in powermail and i use powermail Finisher class like below.
TYPOSCRIPT:
plugin.tx_powermail.settings.setup {
finishers {
1 {
class = Vendor\Ext\Finisher\AddImageFinisher
config {
# set pid.
pid = TEXT
pid.value = 79 // Here
#set powermail fields title
field_name = Name
field_place = Place
field_email = E-Mail
field_message = Message
}
}
}
}
Please reffere this link. AddImageFinisher Class file

At the moment powermail don't uses FAL relations. If you need something like this, you have to add an own finisher that does the upload stuff - see https://docs.typo3.org/typo3cms/extensions/powermail/ForDevelopers/AddFinisherClasses/Index.html

Just for the record. TYPO3 8 core ships a new form extension which allows both. With the save to database finisher you can easily edit fe_user data. Furthermore, all image uploads are handled as FAL. We will document this use case and release a small extension which does the job (soon).

Related

How to show username in frontend in TYPO3 10?

In TYPO3 9 I managed to display the current username in a FLUID-template with the following Typoscript:
[loginUser=*]
temp.username = TEXT
temp.username {
insertData = 1
value = {TSFE:fe_user|user|username}
noTrimWrap = | ||
}
[global]
In TYPO3 10.4 this is not working anymore. Any idea how to display the current user?
Many thanks! Urs
In Typo3 V10, you have to use the Context API to retrieve data from global objects, try this :
[frontend.user.isLoggedIn]
temp.username = TEXT
temp.username.data = TSFE:fe_user|user|name
temp.username.wrap = |
[global]
Have a look at those links :
https://docs.typo3.org/m/typo3/reference-typoscript/master/en-us/DataTypes/Index.html
https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/ApiOverview/Context/Index.html#context-api
Florian
It's probably not working because you're using the old TypoScript conditions. Since TYPO3 9 the conditions work with Symfony expressions. The old conditions were deprecated in TYPO3 9 (but still worked) and removed in TYPO3 10. So [loginUser=*] will never be true in TYPO3 10. You should use [frontend.user.isLoggedIn] instead.
See https://docs.typo3.org/m/typo3/reference-typoscript/master/en-us/Conditions/Index.html for more about the new TypoScript conditions.
Why use TypoScript? It is very limited on what it can bring back. I just finished a tutorial where you can use a ViewHelper to add an ExtBase variable which assigns the whole user object in the FrontEnd and you can use it wherever you want with all it's relations, even the image, which is difficult to get via TypoScript.
TYPO3 tutorial
Best regards

Reading data out of a flexform in typoscript

I try to read a flexform data out in typoscript. I tried it with several approaches, but none of them works correctly:
ajax.30 = TEXT
ajax.30.value = {$plugin.parser.settings.maxNumber}
ajax.40 < {$plugin.parser.settings.maxNumber}
ajax.50 < {$plugin.parser.settings.maxNumber}
ajax.60 = TEXT
ajax.60.data = {$field:flexform_varNum}
ajax.70 = TEXT
ajax.70.data = flexform : pi_flexform:settings.varNum
Can anyone give me a hint for the right syntax?
I'm using Typo3 9.5.13.
It is not possible to read out FlexForm data without an actual content element.
The CONTENT or COA objects would provide that. See for example Get FlexForm configuration in TypoScript
The feature was added in TYPO3 8.4 https://docs.typo3.org/c/typo3/cms-core/master/en-us/Changelog/8.4/Feature-17309-AccessFlexformValueViaTS.html

Where must finisher files (for powermail finisher) be located?

I am currently trying to add a finisher to my powerplay form.
The target is to delete all elements in a specific folder after the form is submited.
I currently use :
this tutorial
I first put this into my setup.txt
plugin.tx_powermail.settings.setup {
finishers {
1 {
class = Vendor\Ext\Finisher\DoSomethingFinisher
}
}
}
at this location: ftp://ftpIP/typo3cms/pagename/typo3conf/ext/powermail/Configuration/TypoScript/Main/setup.txt
Now i should create a PHP-File:
Add a php-file DoSomethingFinisher.php and extend your class with the AbstractFinisher from powermail:
But where shuld I place that PHP File? In the same place as the setup.txt?
Hope someone can help. Thank you very much.
Thomas
That question is related to TYPO3 autoloading and not to powermail. If you want to add PHP-Files to your TYPO3, you should use an extension.
There are some manuals how to get the autoloading to work with your PHP-Files (see https://docs.typo3.org/typo3cms/CoreApiReference/ApiOverview/Autoloading/Index.html).
You shouldn't modify the files in the folder powermail, otherwise you will be in trouble when you want to update the extension. Instead, create a new extension with extension_builder or take powermailextended and modify that extension.
Assuming you use powermailextended:
If you call the Finisher In2code\Powermailextended\Finisher\MyFinisher, then it needs to go in EXT:powermailextend\Classes\Finisher\MyFinisher - this is how Typo3 autoloads the PHP files.

TYPO3 - How to add a placeholder to an input field?

In TYPO3 (7.2.0) using the standard template engine, is there a way to add a placeholder attribute to the standard mail form text input?
At the moment I am using JavaScript to convert the labels into placeholders, but I am open to suggestions on a better way to do this...
The suggested solution of #biesior does only work for EXT:form 7.4 and higher (see changelog). The supplied picture shows the form wizard of TYPO3 7.5 or 7.6. In 7.2 you won't find any placeholder attribute in the wizard.
I recommend updating to TYPO3 7.6 since this version includes a major rewrite of EXT:form. You will be able to use fluid templates to customize your forms. Furthermore HTML5 attributes are possible. Before the rewrite the set of allowed attributes was quite limited. Now you are able to add all attributes you can think of (for example "data-"). See changelog.
If you have any questions regarding EXT:form join the channel on Slack. If you don't know Slack yet, check out the invite function.
During form fields editing you have many properties, also Placeholder
in text version it will be:
10 = TEXTLINE
10 {
type = text
class = foo-class
id = foo-id
name = foo
placeholder = Hmmm?
required = required
label {
value = My Field
}
}

How to rename subheader in TYPO3 CMS backend

How can I rename a TYPO3 CMS backend field for authors? i.e. the mentioned field for content-elements of csc_styled_content?
In general, overriding label names can by done with Page TSconfig in the backend. The following example modifies the label of the subheader field.
TCEFORM {
tt_content {
subheader.label = My new Label-Name
}
}
There are two way to configure that adjustment in TYPO3.
Type your configuration changes directly to the page settings » resources » TypoScript Configuration » Page TSConfig (see the screenshot below)
as an alternative you can store that configuration directly in the file system - either in your custom extension (e.g. at typo3conf/ext/my_extension/Configuration/TSconfig/labels.t3s) or with a similar name in the global file storage (e.g. fileadmin/templates/configuration/...)
That's basically it to provide custom labels for any database table in the TYPO3 backend. Find more aspects that can be adjusted in the accordant Page TSconfig documentation.
If you want to rename a field of an extension like tx_news you could do it this way.
TCEFORM {
tx_news_domain_model_news {
title.label = Your New Label
}
}
Now there are two ways to get this to work:
Put it in Page TSConfig of the page settings
OR
Load it with your extension from a file (e.g. EXT:my_extension/Configuration/pageTSConfig.typoscript). For that you have to import this script by EXT:my_extension/ext_localconf.php!
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig(
'<INCLUDE_TYPOSCRIPT: source="FILE:EXT:my_extrension/Configuration/pageTSConfig.typoscript">');