Toolbar

ToolBar handler

since

1.5

package

Joomla CMS

Methods

__call

Magic method proxy.

__call( name, mixed||string|int args) : \Joomla\CMS\Toolbar\ToolbarButton
throws

Exception

since

4.0.0

Arguments

name

stringThe method name.

args

array<string|int, mixed>The method arguments.

Response

ToolbarButton

__construct

Constructor

__construct( name = 'toolbar', \Joomla\CMS\Toolbar\ToolbarFactoryInterface factory = null) : 
since

1.5

Arguments

name

stringThe toolbar name.

factory

ToolbarFactoryInterfaceThe toolbar factory.

Response

mixed

addButtonPath

Add a directory where Toolbar should search for button types in LIFO order.

addButtonPath( path) : 
deprecated

You may either pass a string or an array of directories.

Toolbar will be searching for an element type in the same order you added them. If the parameter type cannot be found in the custom folders, it will look in libraries/joomla/html/toolbar/button.

since

1.5

deprecated

4.0 will be removed in 6.0 ToolbarButton classes should be autoloaded via namespaces

Arguments

path

mixedDirectory or directories to search.

Response

void

addNew

Writes the common 'new' icon for the button bar.

addNew( task,  text = 'JTOOLBAR_NEW') : \Joomla\CMS\Toolbar\Button\StandardButton
inherited
since

4.0.0

Arguments

task

stringThe task name of this button.

text

stringThe text of this button.

Response

StandardButton

appendButton

Append a button to toolbar.

appendButton(\Joomla\CMS\Toolbar\ToolbarButton button, mixed||string|int args) : \Joomla\CMS\Toolbar\ToolbarButton|bool
since

1.5

Arguments

button

ToolbarButtonThe button instance.

args

array<string|int, mixed>The more arguments.

Response

ToolbarButton|boolReturn button instance to help chaining configure. If using legacy arguments returns true

apply

Writes a save button for a given option.

apply( task,  text = 'JTOOLBAR_APPLY') : \Joomla\CMS\Toolbar\Button\StandardButton
inherited

Apply operation leads to a save action only (does not leave edit mode).

since

4.0.0

Arguments

task

stringThe task name of this button.

text

stringThe text of this button.

Response

StandardButton

archive

Writes a common 'archive' button.

archive( task,  text = 'JTOOLBAR_ARCHIVE') : \Joomla\CMS\Toolbar\Button\StandardButton
inherited
since

4.0.0

Arguments

task

stringThe task name of this button.

text

stringThe text of this button.

Response

StandardButton

assign

Writes a common 'assign' button for a record.

assign( task,  text = 'JTOOLBAR_ASSIGN') : \Joomla\CMS\Toolbar\Button\StandardButton
inherited
since

4.0.0

Arguments

task

stringThe task name of this button.

text

stringThe text of this button.

Response

StandardButton

back

Writes a cancel button that will go back to the previous page without doing any other operation.

back( text = 'JTOOLBAR_BACK') : \Joomla\CMS\Toolbar\Button\LinkButton
inherited
since

4.0.0

Arguments

text

stringThe text of button.

Response

LinkButton

basicButton

basicButton( name = '',  text = '',  task = '') : \Joomla\CMS\Toolbar\Button\BasicButton

Arguments

name = ''

string

text = ''

string

task = ''

string

Response

BasicButton

cancel

Writes a cancel button and invokes a cancel operation (eg a checkin).

cancel( task,  text = 'JTOOLBAR_CLOSE') : \Joomla\CMS\Toolbar\Button\StandardButton
inherited
since

4.0.0

Arguments

task

stringThe task name of this button.

text

stringThe text of this button.

Response

StandardButton

checkin

Writes a checkin button for a given option.

checkin( task,  text = 'JTOOLBAR_CHECKIN') : \Joomla\CMS\Toolbar\Button\StandardButton
inherited
since

4.0.0

Arguments

task

stringThe task name of this button.

text

stringThe text of this button.

Response

StandardButton

confirmButton

confirmButton( name = '',  text = '',  task = '') : \Joomla\CMS\Toolbar\Button\ConfirmButton

Arguments

name = ''

string

text = ''

string

task = ''

string

Response

ConfirmButton

createChild

Create child toolbar.

createChild( name) : 
since

4.0.0

Arguments

name

stringThe toolbar name.

Response

static

customButton

customButton( name = '',  text = '',  task = '') : \Joomla\CMS\Toolbar\Button\CustomButton

Arguments

name = ''

string

text = ''

string

task = ''

string

Response

CustomButton

customHtml

Writes a custom HTML to toolbar.

customHtml( html,  name = 'custom') : \Joomla\CMS\Toolbar\Button\CustomButton
inherited
since

4.0.0

Arguments

html

stringThe HTML string to write.

name

stringThe button name.

Response

CustomButton

delete

Writes a common 'delete' button.

delete( task,  text = 'JTOOLBAR_DELETE') : \Joomla\CMS\Toolbar\Button\ConfirmButton
inherited
since

4.0.0

Arguments

task

stringThe task name of this button.

text

stringThe text of this button.

Response

ConfirmButton

divider

Writes a divider between dropdown menu items.

divider( text = '') : \Joomla\CMS\Toolbar\Button\SeparatorButton
inherited
since

4.0.0

Arguments

text

stringThe text of button.

Response

SeparatorButton

dropdownButton

dropdownButton( name = '',  text = '',  task = '') : \Joomla\CMS\Toolbar\Button\DropdownButton

Arguments

name = ''

string

text = ''

string

task = ''

string

Response

DropdownButton

edit

Writes a common 'edit' button.

edit( task,  text = 'JTOOLBAR_EDIT') : \Joomla\CMS\Toolbar\Button\StandardButton
inherited
since

4.0.0

Arguments

task

stringThe task name of this button.

text

stringThe text of this button.

Response

StandardButton

editCss

Writes a common 'editCss' button.

editCss( task,  text = 'JTOOLBAR_EDIT_CSS') : \Joomla\CMS\Toolbar\Button\StandardButton
inherited
since

4.0.0

Arguments

task

stringThe task name of this button.

text

stringThe text of this button.

Response

StandardButton

editHtml

Writes a common 'editHtml' button.

editHtml( task,  text = 'JTOOLBAR_EDIT_HTML') : \Joomla\CMS\Toolbar\Button\StandardButton
inherited
since

4.0.0

Arguments

task

stringThe task name of this button.

text

stringThe text of this button.

Response

StandardButton

getButtonPath

Get the lookup paths for button objects

getButtonPath() : mixed||string|int
deprecated
since

4.0.0

deprecated

4.0 will be removed in 6.0 ToolbarButton buttons should be autoloaded via namespaces

Response

array<string|int, mixed>

getInstance

Returns the global Toolbar object, only creating it if it doesn't already exist.

getInstance( name = 'toolbar') : \Joomla\CMS\Toolbar\Toolbar
static deprecated
since

1.5

deprecated

4.0 will be removed in 6.0 Use the ToolbarFactoryInterface instead Example: Factory::getContainer()->get(ToolbarFactoryInterface::class)->createToolbar($name)

todo

Needs a proper replacement before removal as ToolbarFactoryInterface alone does not share the object everywhere

throws

KeyNotFoundException

Arguments

name

stringThe name of the toolbar.

Response

ToolbarThe Toolbar object.

getItems

Get the list of toolbar links.

getItems() : mixed||string|int
since

1.6

Response

array<string|int, mixed>

getName

Get the name of the toolbar.

getName() : 
since

1.6

Response

string

help

Writes a help button for a given option (opens a popup window).

help( ref,  useComponent = false,  url = null,  component = null) : \Joomla\CMS\Toolbar\Button\HelpButton
inherited
since

4.0.0

Arguments

ref

stringThe name of the popup file (excluding the file extension for an xml file).

useComponent

boolUse the help file in the component directory.

url

stringUse this URL instead of any other.

component

stringName of component to get Help (null for current component)

Response

HelpButton

helpButton

helpButton( name = '',  text = '',  task = '') : \Joomla\CMS\Toolbar\Button\HelpButton

Arguments

name = ''

string

text = ''

string

task = ''

string

Response

HelpButton

inlinehelp

Writes a help button for a given option (opens a popup window).

inlinehelp( class = 'hide-aware-inline-help') : \Joomla\CMS\Toolbar\Button\InlinehelpButton
inherited
since

4.3.0

Arguments

class

stringThe class used by the inline help items.

Response

InlinehelpButton

inlinehelpButton

inlinehelpButton( name = '',  text = '',  task = '') : \Joomla\CMS\Toolbar\Button\InlinehelpButton

Arguments

name = ''

string

text = ''

string

task = ''

string

Response

InlinehelpButton

jooa11y

Writes a jooa11y accessibility checker button for a given option (opens a popup window).

jooa11y( url,  text = 'JGLOBAL_JOOA11Y',  newWindow = false) : \Joomla\CMS\Toolbar\Button\PopupButton|\Joomla\CMS\Toolbar\Button\LinkButton
inherited
since

4.1.0

Arguments

url

stringThe url to open

text

stringThe text of button.

newWindow

boolWhether to open the preview in _blank or just a modal

Response

PopupButton|LinkButton

linkButton

linkButton( name = '',  text = '',  task = '') : \Joomla\CMS\Toolbar\Button\LinkButton

Arguments

name = ''

string

text = ''

string

task = ''

string

Response

LinkButton

loadButtonType

Loads a button type.

loadButtonType( type,  new = false) : false|\Joomla\CMS\Toolbar\ToolbarButton
since

1.5

Arguments

type

stringButton Type

new

boolFalse by default

Response

false|ToolbarButton

makeDefault

Writes a common 'default' button for a record.

makeDefault( task,  text = 'JTOOLBAR_DEFAULT') : \Joomla\CMS\Toolbar\Button\StandardButton
inherited
since

4.0.0

Arguments

task

stringAn override for the task.

text

stringAn override for the alt text.

Response

StandardButton

mediaManager

Writes a media_manager button.

mediaManager( directory,  text = 'JTOOLBAR_UPLOAD') : \Joomla\CMS\Toolbar\Button\PopupButton
inherited
since

4.0.0

Arguments

directory

stringThe subdirectory to upload the media to.

text

stringAn override for the alt text.

Response

PopupButton

popupButton

popupButton( name = '',  text = '',  task = '') : \Joomla\CMS\Toolbar\Button\PopupButton

Arguments

name = ''

string

text = ''

string

task = ''

string

Response

PopupButton

preferences

Writes a configuration button and invokes a cancel operation (eg a checkin).

preferences( component,  text = 'JTOOLBAR_OPTIONS',  path = '') : \Joomla\CMS\Toolbar\Button\LinkButton
inherited
since

4.0.0

Arguments

component

stringThe name of the component, eg, com_content.

text

stringThe text of this button.

path

stringAn alternative path for the configuration xml relative to JPATH_SITE.

Response

LinkButton

prependButton

Prepend a button to toolbar.

prependButton(\Joomla\CMS\Toolbar\ToolbarButton button, mixed||string|int args) : \Joomla\CMS\Toolbar\ToolbarButton|bool
since

1.5

Arguments

button

ToolbarButtonThe button instance.

args

array<string|int, mixed>The more arguments.

Response

ToolbarButton|boolReturn button instance to help chaining configure. If using legacy arguments returns true

preview

Writes a preview button for a given option (opens a popup window).

preview( url,  text = 'JGLOBAL_PREVIEW',  newWindow = false) : \Joomla\CMS\Toolbar\Button\PopupButton|\Joomla\CMS\Toolbar\Button\LinkButton
inherited
since

4.0.0

Arguments

url

stringThe name of the popup file (excluding the file extension)

text

stringThe text of button.

newWindow

boolWhether to open the preview in _blank or just a modal

Response

PopupButton|LinkButton

publish

Writes a common 'publish' button.

publish( task,  text = 'JTOOLBAR_PUBLISH') : \Joomla\CMS\Toolbar\Button\StandardButton
inherited
since

4.0.0

Arguments

task

stringThe task name of this button.

text

stringThe text of this button.

Response

StandardButton

render

Render a toolbar.

render(mixed||string|int options = []) : 
throws

Exception

since

1.5

Arguments

options

array<string|int, mixed>The options of toolbar.

Response

stringHTML for the toolbar.

renderButton

Render a button.

renderButton(mixed||string|int &node) : 
since

1.5

throws

Exception

Arguments

node

array<string|int, mixed>A toolbar node.

Response

string

save

Writes a save button for a given option.

save( task,  text = 'JTOOLBAR_SAVE') : \Joomla\CMS\Toolbar\Button\StandardButton
inherited

Save operation leads to a save and then close action.

since

4.0.0

Arguments

task

stringThe task name of this button.

text

stringThe text of this button.

Response

StandardButton

save2copy

Writes a save as copy button for a given option.

save2copy( task,  text = 'JTOOLBAR_SAVE_AS_COPY') : \Joomla\CMS\Toolbar\Button\StandardButton
inherited

Save as copy operation leads to a save after clearing the key, then returns user to edit mode with new key.

since

4.0.0

Arguments

task

stringThe task name of this button.

text

stringThe text of this button.

Response

StandardButton

save2new

Writes a save and create new button for a given option.

save2new( task,  text = 'JTOOLBAR_SAVE_AND_NEW') : \Joomla\CMS\Toolbar\Button\StandardButton
inherited

Save and create operation leads to a save and then add action.

since

4.0.0

Arguments

task

stringThe task name of this button.

text

stringThe text of this button.

Response

StandardButton

separatorButton

separatorButton( name = '',  text = '',  task = '') : \Joomla\CMS\Toolbar\Button\SeparatorButton

Arguments

name = ''

string

text = ''

string

task = ''

string

Response

SeparatorButton

setFactory

Set the factory instance

setFactory(\Joomla\CMS\Toolbar\ToolbarFactoryInterface factory) : 
since

4.0.0

Arguments

factory

ToolbarFactoryInterfaceThe factory instance

Response

$this

setItems

Set the button list.

setItems(\Joomla\CMS\Toolbar\ToolbarButton||string|int items) : 
since

4.0.0

Arguments

items

array<string|int, ToolbarButton>The button list array.

Response

static

standardButton

standardButton( name = '',  text = '',  task = '') : \Joomla\CMS\Toolbar\Button\StandardButton

Arguments

name = ''

string

text = ''

string

task = ''

string

Response

StandardButton

trash

Writes a common 'trash' button.

trash( task,  text = 'JTOOLBAR_TRASH') : \Joomla\CMS\Toolbar\Button\StandardButton
inherited
since

4.0.0

Arguments

task

stringThe task name of this button.

text

stringThe text of this button.

Response

StandardButton

unarchive

Writes a common 'unarchive' button.

unarchive( task,  text = 'JTOOLBAR_UNARCHIVE') : \Joomla\CMS\Toolbar\Button\StandardButton
inherited
since

4.0.0

Arguments

task

stringThe task name of this button.

text

stringThe text of this button.

Response

StandardButton

unpublish

Writes a common 'unpublish' button.

unpublish( task,  text = 'JTOOLBAR_UNPUBLISH') : \Joomla\CMS\Toolbar\Button\StandardButton
inherited
since

4.0.0

Arguments

task

stringThe task name of this button.

text

stringThe text of this button.

Response

StandardButton

versions

Writes a version history

versions( typeAlias,  itemId,  height = 800,  width = 500,  text = 'JTOOLBAR_VERSIONS') : \Joomla\CMS\Toolbar\Button\CustomButton
inherited
since

4.0.0

Arguments

typeAlias

stringThe component and type, for example 'com_content.article'

itemId

intThe id of the item, for example the article id.

height

intThe height of the popup.

width

intThe width of the popup.

text

stringThe name of the button.

Response

CustomButton

Properties

_name

Toolbar name

since

1.5

Type(s)

string

_bar

Toolbar array

since

1.5

Type(s)

array<string|int, mixed>

_buttonPath

Directories, where button types can be stored.

since

1.5

Type(s)

array<string|int, mixed>

instances

Stores the singleton instances of various toolbar.

static
since

2.5

Type(s)

array<string|int, Toolbar>

factory

Factory for creating Toolbar API objects

since

4.0.0

Type(s)

ToolbarFactoryInterface