Actions

API15

JEditor/getButtons

From Joomla! Documentation

< API15:JEditor
Revision as of 11:46, 12 May 2013 by JoomlaWikiBot (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

Contents

Description

Get the editor buttons

[<! removed edit link to red link >]

<! removed transcluded page call, red link never existed >

Syntax

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. public
$buttons true

Defined in

libraries/joomla/html/editor.php

Importing

jimport( 'joomla.html.editor' );

Source Body

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);
               }
 
               // Try to authenticate -- only add to array if authentication is successful
               $resultTest = $plugin->onDisplay($editor);
               if ($resultTest) $result[] =  $resultTest;
       }
 
       return $result;
}

[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >

Examples

<CodeExamplesForm />