从特定页面提交表单(Concrete5 8.3.2)
Form submission from specific page (Concrete5 8.3.2)
CMS:混凝土5
版本:8.3.2
我在全局区域中添加了一个 Express Form 块。如果有人填写表格,我会收到一封电子邮件回复。在电子邮件回复中,不清楚表单是从哪个特定页面发送的。它只显示表单的名称(由于全局区域,所有页面上都相同)、表单结果和 link 导致 CMS。
所以我需要在 express_form > controller.php
中插入类似 $page->getCollectionName()
的内容
我找到了 link (https://www.concrete5.org/community/forums/customizing_c5/form-submission-from-specific-page/#905411),但这是旧版本的,在最新版本中似乎不起作用。
有什么想法吗?
编辑解决方案:
已编辑:block_express_form_submission.php
<?php
defined('C5_EXECUTE') or die("Access Denied.");
$formDisplayUrl = URL::to('/dashboard/reports/forms', 'view', $entity->getEntityResultsNodeId());
$c = Page::getCurrentPage();
$submittedData = '';
foreach($attributes as $value) {
$submittedData .= $value->getAttributeKey()->getAttributeKeyDisplayName('text') . ":\r\n";
$submittedData .= $value->getPlainTextValue() . "\r\n\r\n";
}
$body = t("
Form pagename: %s
Form name: %s
%s
View all form results %s
", $c->getCollectionName(), $formName, $submittedData, $formDisplayUrl);
concrete5 使用 /concrete/mail/block_form_submission.php
电子邮件模板发送有关 Express 表单提交的通知。
您可以通过将此文件复制到 /application/mail
文件夹并进行编辑来自定义此模板。
例如,要添加页面名称,您可以添加以下行:
$c = Page::getCurrentPage();
$body .= "\n" . t('Page name: %s', $c->getCollectionName());
CMS:混凝土5 版本:8.3.2
我在全局区域中添加了一个 Express Form 块。如果有人填写表格,我会收到一封电子邮件回复。在电子邮件回复中,不清楚表单是从哪个特定页面发送的。它只显示表单的名称(由于全局区域,所有页面上都相同)、表单结果和 link 导致 CMS。
所以我需要在 express_form > controller.php
$page->getCollectionName()
的内容
我找到了 link (https://www.concrete5.org/community/forums/customizing_c5/form-submission-from-specific-page/#905411),但这是旧版本的,在最新版本中似乎不起作用。
有什么想法吗?
编辑解决方案:
已编辑:block_express_form_submission.php
<?php
defined('C5_EXECUTE') or die("Access Denied.");
$formDisplayUrl = URL::to('/dashboard/reports/forms', 'view', $entity->getEntityResultsNodeId());
$c = Page::getCurrentPage();
$submittedData = '';
foreach($attributes as $value) {
$submittedData .= $value->getAttributeKey()->getAttributeKeyDisplayName('text') . ":\r\n";
$submittedData .= $value->getPlainTextValue() . "\r\n\r\n";
}
$body = t("
Form pagename: %s
Form name: %s
%s
View all form results %s
", $c->getCollectionName(), $formName, $submittedData, $formDisplayUrl);
concrete5 使用 /concrete/mail/block_form_submission.php
电子邮件模板发送有关 Express 表单提交的通知。
您可以通过将此文件复制到 /application/mail
文件夹并进行编辑来自定义此模板。
例如,要添加页面名称,您可以添加以下行:
$c = Page::getCurrentPage();
$body .= "\n" . t('Page name: %s', $c->getCollectionName());