I am trying to create a contact us form with the following fields and file attachments on Magento 2.3.2:
<?php
// @codingStandardsIgnoreFile
?>
<?php
$themeHelper = $this->helper('MGS\Mpanel\Helper\Data');
$canUsePanel = $themeHelper->acceptToUsePanel();
?>
<div class="contact-form-content">
<div class="row">
<div class="col-sm-6 col-xs-12 margin-bottom60">
<!-- Static block contact_page_custom_block -->
<p>Nav goes here </p>
</div>
<div class="col-sm-6 col-xs-12 margin-bottom60">
<h3 class="text-uppercase margin-bottom15"><?php echo __('Send us a message'); ?></h3>
<form class="form contact" action="<?php /* @escapeNotVerified */ echo $block->getFormAction(); ?>" id="contact-form" method="post" data-hasrequired="<?php /* @escapeNotVerified */ echo __('* Required Fields') ?>" data-mage-init='{"validation":{}}'>
<fieldset>
<div class="form-group name required">
<label for="name"><?php echo __('First Name'); ?></label>
<input name="name" id="name" title="<?php /* @escapeNotVerified */ echo __('First Name') ?>" value="<?php echo $block->escapeHtml($this->helper('Magento\Contact\Helper\Data')->getUserName()) ?>" class="input-text form-control" type="text" data-validate="{required:true}"/>
</div>
<div class="form-group name required">
<label for="name"><?php echo __('Last Name'); ?></label>
<input name="name" id="name" title="<?php /* @escapeNotVerified */ echo __('Last Name') ?>" value="" class="input-text form-control" type="text" data-validate="{required:true}"/>
</div>
</fieldset>
<div class="form-group email required">
<label for="email"><?php echo __('Email'); ?></label>
<input name="email" id="email" title="<?php /* @escapeNotVerified */ echo __('Email') ?>" value="<?php echo $block->escapeHtml($this->helper('Magento\Contact\Helper\Data')->getUserEmail()) ?>" class="input-text form-control" type="email" data-validate="{required:true, 'validate-email':true}"/>
</div>
<div class="form-group topic required">
<label for="topic"><?php /* @escapeNotVerified */ echo __('Topic') ?></label>
<select name="topic" id="topic">
<option value="selected">Select a Topic</option>
<option name="items" value="Items">Items</option>
<option name="shpping" value="Shipping">Shipping</option>
</select>
</div>
<div class="form-group comment required">
<label for="comment"><?php echo __('Message'); ?></label>
<textarea name="comment" id="comment" title="<?php /* @escapeNotVerified */ echo __('Content') ?>" class="input-text form-control" cols="5" rows="7" data-validate="{required:true}"></textarea>
</div>
<div class="field attachment-pdf required">
<label class="label" for="attachment-pdf"><span><?php /* @escapeNotVerified */ echo __('PDF') ?></span></label>
<div class="control">
<input name="attachment-pdf" id="attachment-pdf" accept="pdf/*" name="attachment-pdf" type="file" value="" />
</div>
</div>
<div class="field attachment-image required">
<label class="label" for="attachment-image"><span><?php /* @escapeNotVerified */ echo __('Image') ?></span></label>
<div class="control">
<input name="attachment-image" id="attachment-image" accept="image/*" name="attachment-image" type="file" value="" />
</div>
</div>
<?= $block->getChildHtml('form.additional.info') ?>
<div class="actions-toolbar">
<input type="hidden" name="hideit" id="hideit" value="" />
<button type="submit" title="<?php /* @escapeNotVerified */ echo __('Send Messages') ?>" class="action submit btn btn-primary">
<span><?php /* @escapeNotVerified */ echo __('Send Messages') ?></span>
</button>
</div>
</form>
</div>
</div>
</div>
But I cannot find a comprehensive guide, most are either super old or lack key information. Ideally I would like to extend the Magento core module Magento_Contact. I was trying to follow this guide but on step two I don't really understand where I am supposed to put the files
Can someone please help me? I don't know why I am struggling with something so basic.
I am trying to use DominicWatts's ContactAttachment but I get the following error on form submit.
Fatal error: Uncaught Error: Call to undefined method Mageplaza\Smtp\Helper\Data::versionCompare() in /var/www/html/app/code/Mageplaza/Smtp/Mail/Transport.php:157 Stack trace: #0 /var/www/html/app/code/Mageplaza/Smtp/Mail/Transport.php(111): Mageplaza\Smtp\Mail\Transport->getMessage(Object(Magento\Email\Model\Transport\Interceptor)) #1 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(135): Mageplaza\Smtp\Mail\Transport->aroundSendMessage(Object(Magento\Email\Model\Transport\Interceptor), Object(Closure)) #2 /var/www/html/vendor/dotmailer/dotmailer-magento2-extension/Plugin/TransportPlugin.php(75): Magento\Email\Model\Transport\Interceptor->Magento\Framework\Interception\{closure}() #3 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(135): Dotdigitalgroup\Email\Plugin\TransportPlugin->aroundSendMessage(Object(Magento\Email\Model\Transport\Interceptor), Object(Closure)) #4 /var/www/html/vendor/magento/module-email/Model/Mail/TransportInterfacePlugin.php(48): Magento\Email\Model\Transpor in /var/www/html/app/code/Mageplaza/Smtp/Mail/Transport.php on line 157