Skip to content

Instantly share code, notes, and snippets.

@ProfessorLogout
Created December 27, 2017 17:17
Show Gist options
  • Save ProfessorLogout/b646028515cfceb751ef068f9b10fde4 to your computer and use it in GitHub Desktop.
Save ProfessorLogout/b646028515cfceb751ef068f9b10fde4 to your computer and use it in GitHub Desktop.
SoloForm Template Override For Joomla
<?php
/**
* @package Joomla.Site
* @subpackage com_contact
*
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
$tparams = $this->item->params;
// Normally set in the *_forms.php
JHtml::_('behavior.keepalive');
JHtml::_('behavior.formvalidator');
?>
<div class="contact<?php echo $this->pageclass_sfx; ?>" itemscope itemtype="https://schema.org/Person">
<?php if ($tparams->get('show_page_heading')) : ?>
<h1>
<?php echo $this->escape($tparams->get('page_heading')); ?>
</h1>
<?php endif; ?>
<?php // If the form is enabled for the user and either a e-mail or a user is set we display a form ?>
<?php if ($tparams->get('show_email_form') && ($this->contact->email_to || $this->contact->user_id)) : ?>
<div class="contact-form">
<form id="contact-form" action="<?php echo JRoute::_('index.php'); ?>" method="post" class="form-validate form-horizontal well">
<?php foreach ($this->form->getFieldsets() as $fieldset) : ?>
<?php if ($fieldset->name === 'captcha' && !$this->captchaEnabled) : ?>
<?php continue; ?>
<?php endif; ?>
<?php $fields = $this->form->getFieldset($fieldset->name); ?>
<?php if (count($fields)) : ?>
<fieldset>
<?php if (isset($fieldset->label) && ($legend = trim(JText::_($fieldset->label))) !== '') : ?>
<legend><?php echo $legend; ?></legend>
<?php endif; ?>
<?php foreach ($fields as $field) : ?>
<?php echo $field->renderField(); ?>
<?php endforeach; ?>
</fieldset>
<?php endif; ?>
<?php endforeach; ?>
<div class="control-group">
<div class="controls">
<button class="btn btn-primary validate" type="submit"><?php echo JText::_('COM_CONTACT_CONTACT_SEND'); ?></button>
<input type="hidden" name="option" value="com_contact" />
<input type="hidden" name="task" value="contact.submit" />
<input type="hidden" name="return" value="<?php echo $this->return_page; ?>" />
<input type="hidden" name="id" value="<?php echo $this->contact->slug; ?>" />
<?php echo JHtml::_('form.token'); ?>
</div>
</div>
</form>
</div>
<?php endif; ?>
</div>
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="SoloForm" option="Shows the contact form of one contact">
<message>
Shows the contact form of one contact
</message>
</layout>
<!-- Add fields to the request variables for the layout. -->
<fields name="request">
<fieldset name="request"
addfieldpath="/administrator/components/com_contact/models/fields"
>
<field
name="id"
type="modal_contact"
label="COM_CONTACT_SELECT_CONTACT_LABEL"
description="COM_CONTACT_SELECT_CONTACT_DESC"
required="true"
select="true"
new="true"
edit="true"
clear="true"
/>
</fieldset>
</fields>
<!-- Add fields to the parameters object for the layout. -->
<fields name="params">
<!-- Form options. -->
<fieldset name="Contact_Form"
label="COM_CONTACT_MAIL_FIELDSET_LABEL"
>
<field
name="show_email_form"
type="list"
label="COM_CONTACT_FIELD_EMAIL_SHOW_FORM_LABEL"
description="COM_CONTACT_FIELD_EMAIL_SHOW_FORM_DESC"
class="chzn-color"
>
<option value="1">JSHOW</option>
</field>
<field
name="show_email_copy"
type="list"
label="COM_CONTACT_FIELD_EMAIL_EMAIL_COPY_LABEL"
description="COM_CONTACT_FIELD_EMAIL_EMAIL_COPY_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="banned_email"
type="textarea"
label="COM_CONTACT_FIELD_CONFIG_BANNED_EMAIL_LABEL"
description="COM_CONTACT_FIELD_CONFIG_BANNED_EMAIL_DESC"
cols="30"
rows="3"
/>
<field
name="banned_subject"
type="textarea"
label="COM_CONTACT_FIELD_CONFIG_BANNED_SUBJECT_LABEL"
description="COM_CONTACT_FIELD_CONFIG_BANNED_SUBJECT_DESC"
cols="30"
rows="3"
/>
<field
name="banned_text"
type="textarea"
label="COM_CONTACT_FIELD_CONFIG_BANNED_TEXT_LABEL"
description="COM_CONTACT_FIELD_CONFIG_BANNED_TEXT_DESC"
cols="30"
rows="3"
/>
<field
name="validate_session"
type="list"
label="COM_CONTACT_FIELD_CONFIG_SESSION_CHECK_LABEL"
description="COM_CONTACT_FIELD_CONFIG_SESSION_CHECK_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field
name="custom_reply"
type="list"
label="COM_CONTACT_FIELD_CONFIG_CUSTOM_REPLY_LABEL"
description="COM_CONTACT_FIELD_CONFIG_CUSTOM_REPLY_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field
name="redirect"
type="text"
label="COM_CONTACT_FIELD_CONFIG_REDIRECT_LABEL"
description="COM_CONTACT_FIELD_CONFIG_REDIRECT_DESC"
size="30"
useglobal="true"
/>
</fieldset>
</fields>
</metadata>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment