Skip to content

Instantly share code, notes, and snippets.

@carcam
Last active August 16, 2017 12:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carcam/62fe09f3487b19a5f40c1ae56d4cebe9 to your computer and use it in GitHub Desktop.
Save carcam/62fe09f3487b19a5f40c1ae56d4cebe9 to your computer and use it in GitHub Desktop.
Override to add privacy policy checkbox to com_contact
<?php
/**
* @author Carlos Cámara
* @url https://www.hepta.es
*
* @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;
JHtml::_('behavior.keepalive');
JHtml::_('behavior.formvalidator');
?>
<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; ?>
<div class="control-group">
<div class="control-label">
<?php if ($this->contact->params->get('linke')) : ?>
<label id="jform_contact_email_accept-lbl" for="jform_contact_email_accept" class="hasPopover required" title="" data-content="Debe aceptar las condiciones de uso para poder continuar" data-original-title="Aceptar condiciones de uso" aria-invalid="false">
Acepto las <a href="<?= $this->contact->params->get('linke');?>" target="_blank">condiciones de uso</a></label>
<?php else :?>
<label id="jform_contact_email_accept-lbl" for="jform_contact_email_accept" class="hasPopover required" title="" data-content="Debe aceptar las condiciones de uso para poder continuar" data-original-title="Aceptar condiciones de uso" aria-invalid="false">
Acepto las condiciones de uso</label>
<?php endif; ?>
<span class="star">&nbsp;*</span>
</div>
<div class="controls"><input name="jform[contact_email_accept]" id="jform_contact_email_accept" class="required" value="1" type="checkbox"></div>
</div>
</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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment