first commit
This commit is contained in:
57
plugins/convertforms/emails/form/fields.xml
Normal file
57
plugins/convertforms/emails/form/fields.xml
Normal file
@@ -0,0 +1,57 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form>
|
||||
<fieldset>
|
||||
<field name="recipient" type="text"
|
||||
label="COM_CONVERTFORMS_EMAILS_RECIPIENT"
|
||||
description="COM_CONVERTFORMS_EMAILS_RECIPIENT_DESC"
|
||||
hint="COM_CONVERTFORMS_EMAILS_RECIPIENT"
|
||||
class="show-smart-tags"
|
||||
default="{site.email}"
|
||||
required="true"
|
||||
/>
|
||||
<field name="subject" type="text"
|
||||
label="COM_CONVERTFORMS_EMAILS_SUBJECT"
|
||||
hint="COM_CONVERTFORMS_EMAILS_SUBJECT"
|
||||
class="show-smart-tags"
|
||||
default="New Submission #{submission.id}: Contact Form"
|
||||
required="true"
|
||||
/>
|
||||
<field name="from_name" type="text"
|
||||
label="COM_CONVERTFORMS_EMAILS_FROM"
|
||||
hint="COM_CONVERTFORMS_EMAILS_FROM"
|
||||
class="show-smart-tags"
|
||||
default="{site.name}"
|
||||
required="true"
|
||||
/>
|
||||
<field name="from_email" type="text"
|
||||
label="COM_CONVERTFORMS_EMAILS_FROM_EMAIL"
|
||||
hint="COM_CONVERTFORMS_EMAILS_FROM_EMAIL"
|
||||
class="show-smart-tags"
|
||||
default="{site.email}"
|
||||
required="true"
|
||||
/>
|
||||
<field name="reply_to" type="text"
|
||||
label="COM_CONVERTFORMS_EMAILS_REPLY_TO"
|
||||
hint="COM_CONVERTFORMS_EMAILS_REPLY_TO"
|
||||
class="show-smart-tags"
|
||||
/>
|
||||
<field name="reply_to_name" type="text"
|
||||
label="COM_CONVERTFORMS_EMAILS_REPLY_TO_NAME"
|
||||
hint="COM_CONVERTFORMS_EMAILS_REPLY_TO_NAME"
|
||||
class="show-smart-tags"
|
||||
/>
|
||||
<field name="body" type="textarea"
|
||||
label="COM_CONVERTFORMS_EMAILS_BODY"
|
||||
class="editorx show-smart-tags"
|
||||
filter="raw"
|
||||
required="true"
|
||||
default="{all_fields}"
|
||||
/>
|
||||
<field name="attachments" type="text"
|
||||
label="COM_CONVERTFORMS_EMAILS_ATTACHMENT"
|
||||
description="COM_CONVERTFORMS_EMAILS_ATTACHMENT_DESC"
|
||||
hint="images/myattachment.pdf"
|
||||
class="show-smart-tags"
|
||||
/>
|
||||
</fieldset>
|
||||
</form>
|
||||
47
plugins/convertforms/emails/form/fields/cfsubform.php
Normal file
47
plugins/convertforms/emails/form/fields/cfsubform.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Convert Forms
|
||||
* @version 3.2.12 Free
|
||||
*
|
||||
* @author Tassos Marinos <info@tassos.gr>
|
||||
* @link http://www.tassos.gr
|
||||
* @copyright Copyright © 2020 Tassos Marinos All Rights Reserved
|
||||
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
JFormHelper::loadFieldClass('subform');
|
||||
|
||||
class JFormFieldCFSubform extends JFormFieldSubform
|
||||
{
|
||||
/**
|
||||
* Method to get the field input markup.
|
||||
*
|
||||
* @return string The field input markup.
|
||||
*
|
||||
* @since 3.6
|
||||
*/
|
||||
protected function getInput()
|
||||
{
|
||||
// The following script toggles the required attribute for all Email Notification options.
|
||||
JFactory::getDocument()->addScriptDeclaration('
|
||||
jQuery(function($) {
|
||||
$("input[name=\'jform[sendnotifications]\']").on("change", function() {
|
||||
var enabled = $(this).is(":checked");
|
||||
var exclude_fields = $("input[id*=reply_to], input[id$=attachments]");
|
||||
var fields = $("#behavior-emails .subform-repeatable-group").find("input, textarea").not(exclude_fields);
|
||||
|
||||
if (enabled) {
|
||||
fields.attr("required", "required").addClass("required");
|
||||
} else {
|
||||
fields.removeAttr("required").removeClass("required");
|
||||
}
|
||||
});
|
||||
});
|
||||
');
|
||||
|
||||
return parent::getInput();
|
||||
}
|
||||
}
|
||||
26
plugins/convertforms/emails/form/form.xml
Normal file
26
plugins/convertforms/emails/form/form.xml
Normal file
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form>
|
||||
<fieldset name="emails" label="COM_CONVERTFORMS_EMAILS" tab="behavior" addfieldpath="plugins/convertforms/emails/form/fields">
|
||||
|
||||
<field name="emails-free-note" type="note"
|
||||
class="alert alert-error"
|
||||
description="COM_CONVERTFORMS_EMAILS_FREE_NOTE"
|
||||
/>
|
||||
|
||||
<field name="sendnotifications" type="nrtoggle"
|
||||
label="COM_CONVERTFORMS_EMAILS_DESC"
|
||||
/>
|
||||
|
||||
<field name="emails" type="cfsubform"
|
||||
formsource="/plugins/convertforms/emails/form/fields.xml"
|
||||
hiddenLabel="true"
|
||||
multiple="true"
|
||||
buttons="false"
|
||||
max="1"
|
||||
showon="sendnotifications:1"
|
||||
default='{ "emails0": {} }'
|
||||
/>
|
||||
|
||||
|
||||
</fieldset>
|
||||
</form>
|
||||
Reference in New Issue
Block a user