【发布时间】:2018-05-18 12:14:32
【问题描述】:
CMS:具体5 版本: 8.3.2
我在全局区域中添加了一个 Express Form Block。如果有人填写表格,我会收到一封电子邮件回复。在电子邮件回复中,不清楚表单是从哪个特定页面发送的。它只显示表单的名称(由于全局区域在所有页面上都相同)、表单结果和指向结果在 CMS 中的链接。
所以我需要在express_form > controller.php 中插入类似$page->getCollectionName() 的内容
我找到了一个链接 (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);
【问题讨论】:
标签: php forms email concrete5 concrete5-8.x