Hi,
bin gerade dabei mir ein kleines Plugin zu schreiben, welches im Editor einen zusätzlichen Button anzeigen soll, welcher aus der XML Datei den Wert holen soll und in den Content eintragen soll.
Es klappt alles bestens. Wenn ich aber die Parameter einlesen will, dann bekomme ich keine Werte. Hat jemand eine Idee was ich falsch mache
flexbutton.xml
flexbutton.phpPHP-Code:<?xml version="1.0" encoding="utf-8"?>
<install version="1.5" type="plugin" group="editors-xtd">
<name>Editor Button - FlexButton</name>
<creationDate>05/2009</creationDate>
<author>Conny Henn</author>
<copyright>Copyright 2009 HennWeb.de All rights reserved!</copyright>
<authorEmail>conny@hennweb.de</authorEmail>
<authorUrl>http://www.hennweb.de</authorUrl>
<license>http://www.gnu.org/copyleft/gpl.html GNU/GPL</license>
<version>0.1</version>
<description>Enables a button which allows you to easily insert a predefinied Content into an Article.</description>
<files>
<filename plugin="flexbutton">flexbutton.php</filename>
</files>
<params>
<param name="buttonlabel" type="text" default="FlexButton" label="Button Label" description="Name of the Button" />
<param name="text_to_include" type="textarea" rows="10" cols="40" default="This is the text which is included in the content" label="Text to include" description="Example Text" />
</params>
</install>
PHP-Code:<?php
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport('joomla.event.plugin');
/**
* Editor Flexbutton
**/
class plgButtonFlexbutton extends JPlugin
{
function plgButtonFlexbutton(& $subject, $config)
{
parent::__construct($subject, $config);
// Load plugin parameters
$plugin = JPluginHelper::getPlugin( 'editors-xtd', 'flexbutton' );
$this->pluginParams = new JParameter( $plugin->params );
}
function onDisplay($name)
{
$getContent = $this->_subject->getContent($name);
$doc =& JFactory::getDocument();
$_option = JRequest::getCmd( 'option' );
$_txtinclude = $this->pluginParams->get( 'txt_to_include' );
$_buttonlabel = $this->pluginParams->get( 'buttonlabel');
$button = new JObject();
$button->set('modal', false);
$button->set('onclick', 'jInsertEditorText(\''.$_txtinclude.'\', \''.$name.'\');return false;' );
$button->set('text', $_buttonlabel);
$button->set('name', 'blank');
$button->set('link', '#');
return $button;
}
}
?>


LinkBack URL
About LinkBacks
Zitieren
Lesezeichen