【问题标题】:Form submission from specific page (Concrete5 8.3.2)从特定页面提交表单(Concrete5 8.3.2)
【发布时间】: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


    【解决方案1】:

    concrete5 使用/concrete/mail/block_form_submission.php 电子邮件模板发送有关 Express Form 提交的通知。

    您可以通过将此文件复制到/application/mail 文件夹并对其进行编辑来自定义此模板。

    例如,要添加页面名称,您可以添加以下行:

    $c = Page::getCurrentPage();
    $body .= "\n" . t('Page name: %s', $c->getCollectionName());
    

    【讨论】:

    • 谢谢你,做得很好!用解决方案更新了我的问题。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-09-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-07-12
    相关资源
    最近更新 更多