Paginator Route don't work correctly on the frontpage - neoscms

The Route for a Paginator won't work on the frontpage (because of the / after {node}). Is there another way to achieve this?
name: 'pagination page > 1'
uriPattern: '{node}/page/{--itemPaginator.currentPage}'
defaults:
'#package': 'Neos.Neos'
'#controller': 'Frontend\Node'
'#format': 'html'
'#action': 'show'
'--itemPaginator':
'#package': ''
'#subpackage': ''
'#controller': ''
'#action': 'index'
'#format': 'html'
routeParts:
node:
handler: Neos\Neos\Routing\FrontendNodeRoutePartHandler```

uriPattern: '{node}?page-{--itemPaginator.currentPage}' does work.
Not a real solution but could be a good workaround. If someone has a better solution then let me know.

Related

typo3 : Routing config for my own extension

I'm using typo3 v9.5 and have my own extension.
Actually I'm trying to get a clean URL with route Enhancers, it's my first time with it
I need an url like this :
https://www.mywebsite.com/{my-category}
and actually I have this :
https://www.mywebsite.com/{my-category}?tx_plugin_plugin%5BpageId%5D=102
&cHash=d6374a0e73ca3fde9c60edf88cfdf7cf
I have a second argument pageId, but it is possible to hide it on the url ?
this is my config.yaml :
Myext:
type: Extbase
extension: Myext
plugin: Myext
routes:
- { routePath:
'/{categorie-name}',
_controller: 'Categorie::list',
_arguments: {
categorie-name: 'parentCategoryId'
}
}
defaultController: 'Categorie::list'
defaults:
page: '0'
aspects:
categorie-name:
type: PersistedAliasMapper
tableName: 'sys_category'
routeFieldName: 'title'
page:
type: StaticRangeMapper
start: '1'
end: '100'
I have another question, I saw some config about routing, and they have this settings :
tableName: 'sys_category'
routeFieldName: 'slug'
I tried to put slug to instead of 'title' but I got an error because I don't have this field on my sys_category table, it is possible to add this field on a core table of Typo3 ?
Error my table sys_category doesn't have slug field :
You can exclude parameter you don't need in /typo3conf/LocalConfiguration.php,
'FE' => [
'cacheHash' => [
'excludedParameters' => [
'pageId',
],
],
],
may be this will work for you.

TYPO3 - cms-forms - Remove Input from Email

I am trying to remove an input field from the generated email. With Powermail it is relatively easy. There I can exclude fields in the typoscript. How could something like this look with cms-forms?
Example powermail
excludeFromPowermailAllMarker {
# On Confirmation Page (if activated)
confirmationPage {
# add some markernames (commaseparated) which should be excluded
excludeFromMarkerNames = datenschutzbestimmungen, agb
}
}
TYPO3 11.5.12
php 8.1.2
This is possible with the form variants introduced in TYPO3 version 9.
Hide a form element in certain finishers and on the summary step:
type: Form
identifier: test
prototypeName: standard
label: Test
finishers:
-
identifier: EmailToReceiver
options:
subject: Testmail
recipientAddress: tritum#example.org
recipientName: 'Test'
senderAddress: tritum#example.org
senderName: tritum#example.org
renderables:
-
type: Page
identifier: page-1
label: 'Page 1'
renderables:
-
type: Text
identifier: text-1
label: 'Text 1'
variants:
-
identifier: hide-1
renderingOptions:
enabled: false
condition: 'stepType == "SummaryPage" || finisherIdentifier in ["EmailToSender", "EmailToReceiver"]'
-
type: Text
identifier: text-2
label: 'Text 2'
-
type: SummaryPage
identifier: summarypage-1
label: 'Summary step'
The relevant part (which disables rendering of the field in the summary page, the email to sender finisher or the email to sender finisher) is
variants:
-
identifier: hide-1
renderingOptions:
enabled: false
condition: 'stepType == "SummaryPage" || finisherIdentifier in ["EmailToSender", "EmailToReceiver"]'

TYPO3 9.5 Extbase How redirect a call of showAction with a invalide object to a custom page (not 404!)

I want to redirect a call of a showAction with an invalid uid to a custom page. How can I do this with TYPO3 9 when routing and a 404 handling is active? At moment I always end at the 404 because the page is not found..
Where should I attack?
checking plugin settings like throwPageNotFoundExceptionIfActionCantBeResolved? ignore param validation? overwrite errorAction or callActionMethod? write a custom global 404 handling? overwrite routing?
routing + error handling config:
...
type: Extbase
extension: ext
plugin: Pi1
routes:
-
routePath: '/{object}'
_controller: 'object::show'
_arguments:
object: object
defaultController: 'object::list'
defaults:
page: '0'
requirements:
object: '^[0-9].*$'
page: \d+
aspects:
object:
type: PersistedAliasMapper
tableName: tx_ext_domain_model_object
routeFieldName: uid
page:
type: StaticRangeMapper
start: '1'
end: '100'
...
errorHandling:
-
errorCode: '404'
errorHandler: Page
errorContentSource: 't3://page?uid=174'
Ok, the best way is to overwrite the TYPO3-Errorhandling..
config.yaml
errorHandling:
-
errorCode: '404'
errorHandler: PHP
errorPhpClassFQCN: My\secret\namespace\Error\ErrorHandling
ErrorHandling.php
namespace My\secret\namespace\Error;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Core\Error\PageErrorHandler\PageErrorHandlerInterface;
use TYPO3\CMS\Core\Http\RedirectResponse;
class ErrorHandling implements PageErrorHandlerInterface{
/**
* #param ServerRequestInterface $request
* #param string $message
* #param array $reasons
* #return ResponseInterface
*/
public function handlePageError(ServerRequestInterface $request, string $message, array $reasons = []): ResponseInterface{
if (strpos($request->getRequestTarget(), '/page-where-i-want-my-special-404') !== false) {
return new RedirectResponse('/my-custom-404', 404);
}
return new RedirectResponse('/404', 404);
}
}
First of all, custom error handling is an easy way to solve the problem. Given solution by Kroff works fine.
But, it is just working in case of pages with one language. And it is not really useful to add a static path in the comparison (due to possibly changing page slugs).
Has anyone found a solution to check the called page id? Or even better add a default route directly in the route enhancers configuration?
By the way, if you want to keep the typed in url and still show the 404 page (default of typo3 page error handler) just change the return value return parent::handlePageError($request, $message, $reasons); and extend class by PageContentErrorHandler.

Typo3 8.7: Different mail templates for form finisher EmailToReceiver / EmailToSender

I'm using the Typo3 form-module (sysext) with two email-finishers: EmailToReceiver vs. EmailToSender. I set up a custom mailtemplate, but
HOW can I select different mailtemplates for this two different mails?
OR is there another way to send two different mails?
In addition to Mathias Brodala's correct answer, you can also use templateName and templateRootPaths inside each email finisher. It will respect the email format you set with options.format if configured like below:
finishers:
-
identifier: EmailToReceiver
options:
subject: 'E-Mail from website'
recipientAddress: your.company#example.com
recipientName: 'Your Company name'
senderAddress: '{email}'
senderName: '{lastname}'
replyToAddress: ''
carbonCopyAddress: ''
blindCarbonCopyAddress: ''
format: html
attachUploads: 'true'
templateName: '{#format}.html'
templateRootPaths:
20: 'EXT:your_extension/Resources/Private/Forms/Emails/Receiver/'
translation:
language: ''
-
identifier: EmailToSender
options:
subject: 'Your message'
recipientAddress: '{email}'
recipientName: '{lastname}'
senderAddress: your.company#example.com
senderName: 'Your Company name'
replyToAddress: ''
carbonCopyAddress: ''
blindCarbonCopyAddress: ''
format: html
attachUploads: 'true'
templateName: '{#format}.html'
templateRootPaths:
20: 'EXT:your_extension/Resources/Private/Forms/Emails/Sender/'
According to the file paths set above, the templates are then saved in
your_extension/Resources/Private/Forms/Emails/Sender/
Html.html or Plaintext.html
your_extension/Resources/Private/Forms/Emails/Receiver/
Html.html or Plaintext.html
The complete tutorial can be found here.
On GitHub is a working TYPO3 extension with several example forms, including a form with custom mail template only for the sender.
You can use the templatePathAndFilename finisher option to set a custom template for your mails. You can set this for each finisher separately:
finishers:
- identifier: EmailToReceiver
options:
# ...
templatePathAndFilename: EXT:my_site/Resources/Private/Templates/.../EmailToReceiver.html
- identifier: EmailToSender
options:
# ...
templatePathAndFilename: EXT:my_site/Resources/Private/Templates/.../EmailToSender.html

how to set sender_name for the controller Resetting in FOSUserBundle?

I want to change the name of the sender_name of the email during the resetting.
I already have done this while registration and it was successful.
This was done easily by defining fos_user.registration.confirmation.from_email.sender_name.
Now, I am wondering to do the same thing for resetting, but no email was sent.
If I delete the configuration of resetting (as seen below), the email is sent!
fos_user:
db_driver: orm
firewall_name: main
user_class: Minn\UserBundle\Entity\User
registration:
form:
type: minn_user_registration
confirmation:
enabled: true
template: MinnUserBundle:Registration:email.txt.twig
from_email:
address: %the_address%
sender_name: %the_name%
resetting:
token_ttl: 86400
email:
from_email:
address: %the_address%
sender_name: %the_name%
service:
mailer: fos_user.mailer.twig_swift
So, any idea?
Thanks
Solution found!
I just forgot to specify fos_user.resetting.form.* as seen below...
fos_user:
db_driver: orm
firewall_name: main
user_class: Minn\UserBundle\Entity\User
registration:
form:
type: minn_user_registration
confirmation:
enabled: true
template: MinnUserBundle:Registration:email.txt.twig
from_email:
address: %the_address%
sender_name: %the_name%
resetting:
token_ttl: 86400
email:
from_email:
address: %the_address%
sender_name: %the_name%
form:
type: fos_user_resetting
name: fos_user_resetting_form
validation_groups: [ResetPassword, Default]
service:
mailer: fos_user.mailer.twig_swift
Hope it will help others...