CoreFiles by mySites.guru
menu.php75 lines, 1,815 bytes, from Joomla_3.7.0-alpha1-Alpha-Full_Package.zip
Raw History Compare with 3.6.0-alpha
md5
fd67cdac72b90387bb6ffeb6cc6cb378
sha1
2362a87a9278dfc2a6932fc3923fb024f4ff89f1
sha256
d58033dac55bf92e2770c89b2664f5522f05c658a28af0481713ffda48906b3c
<?php
/**
 * @package     Joomla.Plugin
 * @subpackage  Editors-xtd.menu
 *
 * @copyright   Copyright (C) 2005 - 2016 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&amp;view=items&amp;layout=modal&amp;tmpl=component&amp;' . 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;
	}
}

No other release has this exact content. See every version of this file.