私は大々的な検索を続けて、Joomla 1.5のアーティクルエディタに追加のボタンを追加する方法についてのガイドを見つけました。
このチュートリアルは、http://tushev.org/articles/programming/18-how-to-create-an-editor-button-editors-xtd-plugin-for-joomlaから入手できます。
XMLマニフェストの標準が少しずつ変更されているため、これはJoomla 2.5とJoomla 3.0では機能しません。チュートリアルに沿って、このXMLマニフェストを代わりに使用してください。
<?xml version="1.0" encoding="utf-8"?>
<extension version="2.5" type="plugin" method="upgrade" group="editors-xtd">
<name>test</name>
<author>Name</author>
<creationDate>Month 2013</creationDate>
<copyright>Month Name. All rights reserved.</copyright>
<license>GPL</license>
<authorEmail>Email</authorEmail>
<authorUrl>Your URL</authorUrl>
<version>1.0.0</version>
<description>
"adds the button 'test' to the editor"
</description>
<files>
<filename plugin="test">test.php</filename>
</files>
</extension>
チュートリアルPHPは正しく、次のとおりです。
<?php
// no direct access
defined('_JEXEC') or die('Restricted access');
jimport('joomla.plugin.plugin');
class plgButtonTest extends JPlugin {
function plgButtonTest(& $subject, $config)
{
parent::__construct($subject, $config);
}
function onDisplay($name)
{
$js = "
function buttonTestClick(editor) {
txt = prompt('Please enter something','123');
if(!txt) return;
jInsertEditorText('{test '+txt+'}', editor);
}";
$css = ".button2-left .testButton {
background: transparent url(/plugins/editors-xtd/test.png) no-repeat 100% 0px;
}";
$doc = & JFactory::getDocument();
$doc->addScriptDeclaration($js);
$doc->addStyleDeclaration($css);
$button = new JObject();
$button->set('modal', false);
$button->set('onclick', 'buttonTestClick(\''.$name.'\');return false;');
$button->set('text', JText::_('Test'));
$button->set('name', 'testButton');
$button->set('link', '#');
return $button;
}
}
?>
あなたの助けありがとうございました。あなたが他のより良い方法を持っているなら、私は最も感謝しています。
コードを掲載できますか?私はそれを取ってプラグインをインストールし、適切な場所にあり、有効になっています。 – Elin
こんにちはエリン、私はコードを投稿することを検討しましたが、デフォルトのJoomlaのインストールに付属している 'ページ区切り'ボタンのためにすでに利用可能なコードであるため、助けになりません。プラグインは有効になっており、他のエディタ-xtdプラグインと同じ場所にあります。 –
これは完全コピーである場合、名前がxmlの何かと一致する場所の1つを変更できなかった可能性が最も高いです。 – Elin