API16

JEditor/getButtons

From Joomla! Documentation

< API16:JEditor
Revision as of 17:49, 22 March 2010 by Doxiki (talk | contribs) (New page: ===Description=== Get the editor buttons <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>Edit Descripton<nowiki>]</nowiki> </sp...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The "API16" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

Description[edit]

Get the editor buttons

[Edit Descripton]

Template:Description:JEditor/getButtons

Syntax[edit]

getButtons($editor, $buttons=true)
Parameter Name Default Value Description
$editor $buttons Can be boolean or array, if boolean defines if the buttons are displayed, if array defines a list of buttons not to show.
$buttons true

Defined in[edit]

libraries/joomla/html/editor.php

Importing[edit]

jimport( 'joomla.html.editor' );

Source Body[edit]

public function getButtons($editor, $buttons = true)
{
        $result = array();

        if (is_bool($buttons) && !$buttons) {
                return $result;
        }

        // Get plugins
        $plugins = JPluginHelper::getPlugin('editors-xtd');

        foreach($plugins as $plugin) {
                if (is_array($buttons) &&  in_array($plugin->name, $buttons)) {
                        continue;
                }

                $isLoaded = JPluginHelper::importPlugin('editors-xtd', $plugin->name, false);
                $className = 'plgButton'.$plugin->name;

                if (class_exists($className)) {
                        $plugin = new $className($this, (array)$plugin);
                        $plugin->loadLanguage();
                }

                // Try to authenticate
                if ($temp = $plugin->onDisplay($editor)) {
                        $result[] = $temp;
                }
        }

        return $result;
}

[Edit See Also] Template:SeeAlso:JEditor/getButtons

Examples[edit]

<CodeExamplesForm />