get all checked checkbox values from a powermail field in typoscript - typo3

I’m looking for a way to get all checked checkbox-values from a field in a powermail form. I can access single values from the array in my typoscript template with
data = GP:tx_powermail_pi1|field|marker|index.
Is there a way to interate over the array when I don't know the number of checkboxes (dynamically filled) or to serialize the array? I am not experienced with typoscript or powermail but allready tried to find a solution for quite some time.
What i am trying to achieve ist to have a multiselect field for people to send the mail to that gets populated from fe_users.
The relevant code from the typoscript template that overwrites the receiver is:
plugin.tx_powermail {
settings {
setup {
receiver {
enable = {$plugin.tx_powermail.settings.receiver.enable}
overwrite {
email = COA
email {
10 = CONTENT
10 {
table = fe_users
select {
pidInList = 8689
where {
# UID of the fe_users record is given in field with marker {fragegehtan}
data = GP:tx_powermail_pi1|field|fragegehtan|0
wrap = uid=|
intval = 1
}
}
renderObj = COA
renderObj {
10 = TEXT
10.field = email
stdWrap.wrap = |,
}
}
}
}
}
}
}
}
This is supposed to create a comma separated list of uids of all selected fe_users. Ist there any advice how to do it?

Related

powermail should update a `pages`-field

I want to use powermail (7.4.0) to give special page visitors the option to modify a field in the current pages record.
my setting so far:
plugin.tx_powermail.settings.setup {
dbEntry {
1 {
_enable = TEXT
_enable.value = 1
_table = TEXT
_table.value = pages
uid = TEXT
uid.data = TSFE:id
description = TEXT
description.field = abnahmestatus
}
}
prefill {
abnahmestatus = TEXT
abnahmestatus.data = TSFE:description
}
}
How can I get powermail to update the record (instead of inserting)?
How can I prefill the input field with the current value from the pages field?
Answer 1: update instead of insert:
I missed the line
_ifUnique.uid = update
from the manual example.
Answer 2:
I inserted {abnahemstatus} which was not helpfull as it overwrote the typoscript prefill. so:
no value in prefill_value of the field definition
the correct definition is abnahmestatus.data = page:description (TSFE is obsolete)

Get FlexForm configuration in TypoScript

I need to get the page.headerData in typoscript from pi_flexform.How can implement my requirement?
page = PAGE
page {
headerData {
10 = TEXT
10.value =<script>/**********************/</script>
}
}
I am not so sure about what you really need. I am guessing you want to access a FlexForm configuration inside your TypoScript?
Since the version 8.4 this is possible by using plain TypoScript
lib.flexformContent = CONTENT
lib.flexformContent {
table = tt_content
select {
pidInList = this
}
renderObj = COA
renderObj {
10 = TEXT
10 {
data = flexform: pi_flexform:settings.categories
}
}
}
The key flexform is followed by the field which holds the flexform data and the name of the property whose content should be retrieved.
Before 8.4 you need to use a userFunc and retrieve the value by using PHP
$flexFormService = GeneralUtility::makeInstance(FlexFormService::class);
$flexFormKey = str_replace('.', '|', $keyParts[1]);
$settings = $flexFormService->convertFlexFormContentToArray($flexFormContent);

Solr Indexing - Manipulating the search result

I am working with the TYPO3 Solr extension and I have some doubts regarding the solr result set manipulation.
I have added a special configuration for indexing some particular pages in my page tree. ie Pages that starts with the label "Expertise%" .I have managed to added this successfully . And the indexing is working successfully with our any trouble. But what I would like to achieve is that , I want to added parent page title to the search result.i.e
This is the page tree
|---- 1.00.100 (parent page)
|--Subpage 1
|--Subpage 2
|--Expertise
|--Test page`
And in the solr search result should be
1.00.100 - Expertise
Is this possible in TYPO3 Solr. Is there any hook or signalslot available to implement this?
Tried this ,But doesn't seems to work for me ?
plugin.tx_solr.index.queue.expertise_offered = 1
plugin.tx_solr.index.queue.expertise_offered {
table = pages
additionalWhereClause = doktype = 1 AND no_search = 0 AND title LIKE '%Expertise offered%'
fields {
title = title
content = CONTENT
parentPageTitle_stringS = CONTENT
parentPageTitle_stringS {
table = pages
select {
selectFields = title
where = uid = ###pid###
}
markers {
pid.data = field:pid
}
}
content {
table = tt_content
select {
selectFields = header, bodytext
}
renderObj = COA
renderObj {
10 = TEXT
10.field = header
# This removes HTML tags
11 = SOLR_CONTENT
11.field = bodytext
}
}
url = TEXT
url.typolink.parameter = TEXT
url.typolink.parameter.field = uid
}
}
You probably don't need any hook or signal-slot. You can do it as follows:
Add the title of the parent page to your indexing configuration. There is no field for it, but you can dynamically add fields to SOLR documents. This is done by sending the data in a field which has a certain suffix, which determines the field type.
For example: Setting the field parentPageTitle_stringS to the parent pages title in the indexing configuration creates a new stored, single-valued field of type string in the indexed document.
Filling this field could look like this:
plugin.tx_solr {
index {
queue {
<yourindexconfigname> = 1
<yourindexconfigname> {
table = pages
fields {
parentPageTitle_stringS = CONTENT
parentPageTitle_stringS {
# Build a query here to retrieve
# the parent page title.
}
}
}
}
}
}
In your template for search results, you can use the marker ###RESULT_DOCUMENT.parentPageTitle_stringS### to retrieve the field.
The available field types can be found in EXT:solr/Resources/Solr/typo3cores/conf/general_schema_fields.conf from line 157 onwards (refering to version 3.0.0 here).
You should of course use a type other than string if you want to have the result indexed nicely.

Creating dynamic fields in Powermail 2.x

I have a doubt with powermail 2.x extension .
My actual requirement is , I have a form (custom extension) through which I can search some places using zip code. So once user submits the value (eg zip code) , the webiste will be redirected to page where I list all available places under that zip code as link. When a user clicks on that link , Website will be redirected to another page where I hvae configured powermail 2.x extension . What I want to implement is , based on link clicked (I will be passing place_id through the link and each place have some membership types).I want to show a set of membership types in radio buttons(Fetched from another table using the arguments from url). and this items should be there in preview and mail as well.
The same thing we can implement using $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['powermail']['PM_FieldHook'] in powermail 1.6 ?
How we can implement the same in powermail 2.x??
Any help would be appropriated ?
Finally I have managed to fix it by myself.
All you have to do is,
Add a new check box field in the powermial form , In the extended tab , you can assign a typoscript variable something like lib.products .
lib.products = CONTENT
lib.products {
table = pages
select {
pidInList = xxx
}
renderObj = COA
renderObj {
10 = COA
10 {
10 = TEXT
10.dataWrap = {field:title}[\n]
}
}
}
Above code will generate dynamic radio buttons in the frontend.Again if you wish to like create custom field type in powermail field.
tx_powermail.flexForm.type.addFieldOptions.new = Name of the field
tx_powermail.flexForm.type.addFieldOptions.new.dataType = 1 (If it is an array)
After that add the below typoscript code
plugin.tx_powermail.view {
partialRootPath >
partialRootPaths {
10 = EXT:powermail/Resources/Private/Partials/
20 = EXT:extension/Resources/Private/Partials/
}
}
and create a template fileEXT:extension/Resources/Private/Partials/New.html.In that file , you can include field(checkboxes radio buttons or selectboxes).
After that
$signalSlotDispatcher = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Extbase\SignalSlot\Dispatcher');
$signalSlotDispatcher->connect(
'In2code\Powermail\Controller\FormController',
'formActionBeforeRenderView',
'HEV\Extension\Controller\FormController',
'customfucntion',
FALSE
);
we have to implement the signal slot available in powermail 2.X
and in the the
/**
* #param \In2code\Powermail\Domain\Model\Form $form
* #param \In2code\Powermail\Controller\FormController $pObj
*/
public function manipulateMailObjectOnCreate($form, $pObj) {
$sectionNr = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP("SID");
if ( !isset( $sectionNr ))
return ;
foreach ( $form as $forms ){
foreach( $forms->getPages() as $key => $pages){
foreach ( $pages->getFields() as $fields ){
switch ( $fields->getType() ){
case "new":
$fields->setMandatory(TRUE);
$fields->setCreateFromTyposcript('lib.products');
break;
}
}
}
}
}

Typoscript If/Else?

I have two forms in powermail 1.6 and want to change the form action according to the form uid.
I have the following code:
plugin.tx_powermail_pi1 {
formaction >
formaction = TEXT
formaction {
typolink {
parameter = 280
parameter.if {
equals.field = uid
value = 1618
}
...
}
}
}
The code is working - if the id of the form is 1618, then the form action leads to the page with the id 280.
But how can I make an Else statement to change the form action for another form id e.g. 1612 to page id 290?
You have to do it in a COA
formaction = COA
formaction.10 = TEXT
formaction.20 = TEXT
The .10 will handle the true condition.
The .20 will handle the else condition