Toolbar

ToolBar handler

since

1.5

Methods

__call

Magic method proxy.

__call(string $name, array $args) : \Joomla\CMS\Toolbar\ToolbarButton
throws

\Exception

since

4.0.0

Arguments

$name

stringThe method name.

$args

arrayThe method arguments.

Response

\Joomla\CMS\Toolbar\ToolbarButton

__construct

Constructor

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

1.5

Arguments

$name

stringThe toolbar name.

$factory

\Joomla\CMS\Toolbar\ToolbarFactoryInterfaceThe toolbar factory.

addButtonPath

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

addButtonPath(mixed $path) : void
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

5.0 ToolbarButton classes should be autoloaded

Arguments

$path

mixedDirectory or directories to search.

addNew

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

addNew(string $task, string $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

\Joomla\CMS\Toolbar\Button\StandardButton

appendButton

Append a button to toolbar.

appendButton(\Joomla\CMS\Toolbar\ToolbarButton $button, array $args) : \Joomla\CMS\Toolbar\ToolbarButton|boolean
since

1.5

Arguments

$button

\Joomla\CMS\Toolbar\ToolbarButtonThe button instance.

$args

arrayThe more arguments.

Response

\Joomla\CMS\Toolbar\ToolbarButton|booleanReturn button instance to help chaining configure. If using legacy arguments returns true

apply

Writes a save button for a given option.

apply(string $task, string $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

\Joomla\CMS\Toolbar\Button\StandardButton

archive

Writes a common 'archive' button.

archive(string $task, string $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

\Joomla\CMS\Toolbar\Button\StandardButton

assign

Writes a common 'assign' button for a record.

assign(string $task, string $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

\Joomla\CMS\Toolbar\Button\StandardButton

back

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

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

4.0.0

Arguments

$text

stringThe text of button.

Response

\Joomla\CMS\Toolbar\Button\LinkButton

basicButton

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

Arguments

$name

string

$text

string

$task

string

Response

\Joomla\CMS\Toolbar\Button\BasicButton

cancel

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

cancel(string $task, string $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

\Joomla\CMS\Toolbar\Button\StandardButton

checkin

Writes a checkin button for a given option.

checkin(string $task, string $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

\Joomla\CMS\Toolbar\Button\StandardButton

confirmButton

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

Arguments

$name

string

$text

string

$task

string

Response

\Joomla\CMS\Toolbar\Button\ConfirmButton

createChild

Create child toolbar.

createChild(string $name) : static
since

4.0.0

Arguments

$name

stringThe toolbar name.

Response

static

customButton

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

Arguments

$name

string

$text

string

$task

string

Response

\Joomla\CMS\Toolbar\Button\CustomButton

customHtml

Writes a custom HTML to toolbar.

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

4.0.0

Arguments

$html

stringThe HTML string to write.

$name

stringThe button name.

Response

\Joomla\CMS\Toolbar\Button\CustomButton

delete

Writes a common 'delete' button.

delete(string $task, string $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

\Joomla\CMS\Toolbar\Button\ConfirmButton

divider

Writes a divider between dropdown menu items.

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

4.0.0

Arguments

$text

stringThe text of button.

Response

\Joomla\CMS\Toolbar\Button\SeparatorButton

dropdownButton

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

Arguments

$name

string

$text

string

$task

string

Response

\Joomla\CMS\Toolbar\Button\DropdownButton

edit

Writes a common 'edit' button.

edit(string $task, string $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

\Joomla\CMS\Toolbar\Button\StandardButton

editCss

Writes a common 'editCss' button.

editCss(string $task, string $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

\Joomla\CMS\Toolbar\Button\StandardButton

editHtml

Writes a common 'editHtml' button.

editHtml(string $task, string $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

\Joomla\CMS\Toolbar\Button\StandardButton

getButtonPath

Get the lookup paths for button objects

getButtonPath() : array
deprecated
since

4.0.0

deprecated

5.0 ToolbarButton classes should be autoloaded

Response

array

getInstance

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

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

1.5

deprecated

5.0 Use the ToolbarFactoryInterface instead

throws

\Joomla\DI\Exception\KeyNotFoundException

Arguments

$name

stringThe name of the toolbar.

Response

\Joomla\CMS\Toolbar\ToolbarThe Toolbar object.

getItems

Get the list of toolbar links.

getItems() : array
since

1.6

Response

array

getName

Get the name of the toolbar.

getName() : string
since

1.6

Response

string

help

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

help(string $ref, boolean $useComponent = false, string $url = null, string $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

booleanUse 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

\Joomla\CMS\Toolbar\Button\HelpButton

helpButton

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

Arguments

$name

string

$text

string

$task

string

Response

\Joomla\CMS\Toolbar\Button\HelpButton

linkButton

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

Arguments

$name

string

$text

string

$task

string

Response

\Joomla\CMS\Toolbar\Button\LinkButton

loadButtonType

Loads a button type.

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

1.5

Arguments

$type

stringButton Type

$new

booleanFalse by default

Response

false|\Joomla\CMS\Toolbar\ToolbarButton

makeDefault

Writes a common 'default' button for a record.

makeDefault(string $task, string $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

\Joomla\CMS\Toolbar\Button\StandardButton

mediaManager

Writes a media_manager button.

mediaManager(string $directory, string $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

\Joomla\CMS\Toolbar\Button\PopupButton

popupButton

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

Arguments

$name

string

$text

string

$task

string

Response

\Joomla\CMS\Toolbar\Button\PopupButton

preferences

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

preferences(string $component, string $text = 'JTOOLBAR_OPTIONS', string $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

\Joomla\CMS\Toolbar\Button\LinkButton

prependButton

Prepend a button to toolbar.

prependButton(\Joomla\CMS\Toolbar\ToolbarButton $button, array $args) : \Joomla\CMS\Toolbar\ToolbarButton|boolean
since

1.5

Arguments

$button

\Joomla\CMS\Toolbar\ToolbarButtonThe button instance.

$args

arrayThe more arguments.

Response

\Joomla\CMS\Toolbar\ToolbarButton|booleanReturn 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(string $url, string $text = 'JGLOBAL_PREVIEW', boolean $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

booleanWhether to open the preview in _blank or just a modal

Response

\Joomla\CMS\Toolbar\Button\PopupButton|\Joomla\CMS\Toolbar\Button\LinkButton

publish

Writes a common 'publish' button.

publish(string $task, string $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

\Joomla\CMS\Toolbar\Button\StandardButton

render

Render a toolbar.

render(array $options = array()) : string
throws

\Exception

since

1.5

Arguments

$options

arrayThe options of toolbar.

Response

stringHTML for the toolbar.

renderButton

Render a button.

renderButton( &$node) : string
since

1.5

throws

\Exception

Arguments

$node

Response

string

save

Writes a save button for a given option.

save(string $task, string $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

\Joomla\CMS\Toolbar\Button\StandardButton

save2copy

Writes a save as copy button for a given option.

save2copy(string $task, string $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

\Joomla\CMS\Toolbar\Button\StandardButton

save2new

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

save2new(string $task, string $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

\Joomla\CMS\Toolbar\Button\StandardButton

separatorButton

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

Arguments

$name

string

$text

string

$task

string

Response

\Joomla\CMS\Toolbar\Button\SeparatorButton

setFactory

Set the factory instance

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

4.0.0

Arguments

$factory

\Joomla\CMS\Toolbar\ToolbarFactoryInterfaceThe factory instance

Response

$this

setItems

Set the button list.

setItems(array<mixed,\Joomla\CMS\Toolbar\ToolbarButton> $items) : static
since

4.0.0

Arguments

$items

array<mixed,\Joomla\CMS\Toolbar\ToolbarButton>The button list array.

Response

static

standardButton

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

Arguments

$name

string

$text

string

$task

string

Response

\Joomla\CMS\Toolbar\Button\StandardButton

trash

Writes a common 'trash' button.

trash(string $task, string $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

\Joomla\CMS\Toolbar\Button\StandardButton

unarchive

Writes a common 'unarchive' button.

unarchive(string $task, string $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

\Joomla\CMS\Toolbar\Button\StandardButton

unpublish

Writes a common 'unpublish' button.

unpublish(string $task, string $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

\Joomla\CMS\Toolbar\Button\StandardButton

versions

Writes a version history

versions(string $typeAlias, integer $itemId, integer $height = 800, integer $width = 500, string $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

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

$height

integerThe height of the popup.

$width

integerThe width of the popup.

$text

stringThe name of the button.

Response

\Joomla\CMS\Toolbar\Button\CustomButton

Properties

_name

Toolbar name

since

1.5

Type(s)

string

_bar

Toolbar array

since

1.5

Type(s)

array

_buttonPath

Directories, where button types can be stored.

since

1.5

Type(s)

array

instances

Stores the singleton instances of various toolbar.

static
since

2.5

Type(s)

array<mixed,\Joomla\CMS\Toolbar\Toolbar>

factory

Factory for creating Toolbar API objects