- md5
- 76b7f6e641f831b0db7321189f86accc
- sha1
- c9481215aacded95142a8f0f86f70df90aaf0e5f
- sha256
- c20d25b8db6c6800a945d1f6ca5720c23a3fb72bb3648d05cbcf44ca6e420ca6
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
<?php
/**
* @package Joomla.Plugin
* @subpackage Editors-xtd.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;
/**
* Editor Contact buton
*
* @since 3.7.0
*/
class PlgButtonContact extends JPlugin
{
/**
* Load the language file on instantiation.
*
* @var boolean
* @since 3.7.0
*/
protected $autoloadLanguage = true;
/**
* Display the button
*
* @param string $name The name of the button to add
*
* @return JObject The button options as JObject
*
* @since 3.7.0
*/
public function onDisplay($name)
{
/*
* Javascript to insert the link
* View element calls jSelectContact when a contact is clicked
* jSelectContact creates the link tag, sends it to the editor,
* and closes the select frame.
*/
$js = "
function jSelectContact(id, title, catid, object, link, lang)
{
var hreflang = '';
if (lang !== '')
{
var hreflang = ' hreflang = \"' + lang + '\"';
}
var tag = '<a' + hreflang + ' href=\"' + link + '\">' + title + '</a>';
jInsertEditorText(tag, '" . $name . "');
jModalClose();
}";
JFactory::getDocument()->addScriptDeclaration($js);
/*
* Use the built-in element view to select the contact.
* Currently uses blank class.
*/
$link = 'index.php?option=com_contact&view=contacts&layout=modal&tmpl=component&' . JSession::getFormToken() . '=1';
$button = new JObject;
$button->modal = true;
$button->class = 'btn';
$button->link = $link;
$button->text = JText::_('PLG_EDITORS-XTD_CONTACT_BUTTON_CONTACT');
$button->name = 'address';
$button->options = "{handler: 'iframe', size: {x: 800, y: 500}}";
return $button;
}
}
The same content is in 4 releases, Joomla 3.7.0-alpha2 to 3.7.0-beta3. See them all, or every version of this file.