I’m using ConcreteCMS 9.4.8 with the Atomik theme.
I configured the Express form as usual, but when I test submitting, I get the error shown in the image.
I don’t plan to use any paid form add-ons, so I would appreciate it if you could provide an answer using the core form.
I would like to know why I need to use a form, so I would appreciate your guidance.
When you want to use that class, you have two alternatives:
write the full class, with its namespace. For example:
new \Concrete\Core\Express\Entry\Notifier\Notification\FormBlockSubmissionEmailNotification(...);
tell PHP that you want to use FormBlockSubmissionEmailNotification as a shorthand of that long name:
// At the beginning of your file
use Concrete\Core\Express\Entry\Notifier\Notification\FormBlockSubmissionEmailNotification;
// Then you can write
new FormBlockSubmissionEmailNotification(...);
In any case, when you want to create a Concrete class, it’s better to create it with app(): that way you don’t have to pass the class constructor all the parameters it requires, but only the needed ones.
For example, in your case I’d write:
// At the beginning of your file
use Concrete\Core\Express\Entry\Notifier\Notification\FormBlockSubmissionEmailNotification;
// Then you can write
$notifications = [
$this->app->make(FormBlockSubmissionEmailNotification::class, ['blockController' => $this]),
];
The error was not one of the files of the standard ConcreteCMS: it was in the custom file located at /application/blocks/express_form/controller.php.
That’s the file you should fix.
I had customized the system to implement an automatic reply form, and it works correctly on other sites.
However, when I applied the same settings to a newly installed site with ConcreteCMS 9.4.8, an error occurred.
I believe I had previously used the settings described in a case I saw on this forum, and there had been no problems until now.
Currently, an error is being displayed.
<?php
namespace Application\Block\ExpressForm;
use Concrete\Block\ExpressForm\Controller as CoreController;
use Application\Express\Entry\Notifier\Notification\FormBlockSubmissionEmailNotification;
use Concrete\Core\Express\Entry\Notifier\Notification\FormBlockSubmissionNotification;
class Controller extends CoreController
{
public function getNotifications()
{
$notifications = [new FormBlockSubmissionEmailNotification($this->app, $this)];
//if we don't save data we must not use this notifier because entry is already not saved
if ($this->areFormSubmissionsStored()) {
array_unshift($notifications, new FormBlockSubmissionNotification($this->app, $this));
}
return $notifications;
}
}
I changed line 6 of controller.php from use Application\Express\Entry\Notifier\Notification\FormBlockSubmissionEmailNotification;
to use Concrete\Core\Express\Entry\Notifier\Notification\FormBlockSubmissionEmailNotification;
The error disappeared, but I’m not receiving any email replies.
<?php
namespace Application\Block\ExpressForm;
use Concrete\Block\ExpressForm\Controller as CoreController;
use Concrete\Core\Express\Entry\Notifier\Notification\FormBlockSubmissionEmailNotification
use Concrete\Core\Express\Entry\Notifier\Notification\FormBlockSubmissionNotification;
class Controller extends CoreController
{
public function getNotifications()
{
$notifications = [new FormBlockSubmissionEmailNotification($this->app, $this)];
//if we don't save data we must not use this notifier because entry is already not saved
if ($this->areFormSubmissionsStored()) {
array_unshift($notifications, new FormBlockSubmissionNotification($this->app, $this));
}
return $notifications;
}
}
use Concrete\Core\Express\Entry\Notifier\Notification\FormBlockSubmissionEmailNotification;