- md5
- 66fed350d252c745d3937191ba3bc53d
- sha1
- 1108024db5f166a16a1b86e02f1bb7629008c813
- sha256
- b3e4dd66d71540898e01b2bbe01dfab5b7e87848d4fd0d693a07a1f4f82051c9
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
<?php
/**
* @package Joomla.Plugin
* @subpackage Editors-xtd.menu
*
* @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 menu buton
*
* @since 3.7.0
*/
class PlgButtonMenu 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
*
* @since 3.7.0
* @return array
*/
public function onDisplay($name)
{
/*
* Javascript to insert the link
* View element calls jSelectMenuItem when a menu item is clicked
* jSelectMenuItem creates the link tag, sends it to the editor,
* and closes the select frame.
*/
$js = "
function jSelectMenuItem(id, title, tree, object, uri, language)
{
var thislang = '';
if (language !== '')
{
var thislang = '&lang=';
}
var tag = '<a href=\"' + uri + thislang + language + '\">' + title + '</a>';
jInsertEditorText(tag, '" . $name . "');
jModalClose();
}";
$doc = JFactory::getDocument();
$doc->addScriptDeclaration($js);
/*
* Use the built-in element view to select the menu item.
* Currently uses blank class.
*/
$link = 'index.php?option=com_menus&view=items&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_MENU_BUTTON_MENU');
$button->name = 'share-alt';
$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.