diff --git a/administrator/components/com_actionlogs/src/View/Actionlogs/HtmlView.php b/administrator/components/com_actionlogs/src/View/Actionlogs/HtmlView.php
index 5b3ec3a6931a9..a7da6361146c8 100644
--- a/administrator/components/com_actionlogs/src/View/Actionlogs/HtmlView.php
+++ b/administrator/components/com_actionlogs/src/View/Actionlogs/HtmlView.php
@@ -133,13 +133,24 @@ public function display($tpl = null)
protected function addToolbar()
{
ToolbarHelper::title(Text::_('COM_ACTIONLOGS_MANAGER_USERLOGS'), 'icon-list-2');
+ $toolbar = Toolbar::getInstance();
- ToolbarHelper::custom('actionlogs.exportSelectedLogs', 'download', '', 'COM_ACTIONLOGS_EXPORT_CSV', true);
- ToolbarHelper::custom('actionlogs.exportLogs', 'download', '', 'COM_ACTIONLOGS_EXPORT_ALL_CSV', false);
- ToolbarHelper::deleteList('JGLOBAL_CONFIRM_DELETE', 'actionlogs.delete');
- $bar = Toolbar::getInstance('toolbar');
- $bar->appendButton('Confirm', 'COM_ACTIONLOGS_PURGE_CONFIRM', 'delete', 'COM_ACTIONLOGS_TOOLBAR_PURGE', 'actionlogs.purge', false);
- ToolbarHelper::preferences('com_actionlogs');
- ToolbarHelper::help('User_Actions_Log');
+ $toolbar->standardButton('download', 'COM_ACTIONLOGS_EXPORT_CSV', 'actionlogs.exportSelectedLogs')
+ ->icon('icon-download')
+ ->listCheck(true);
+
+ $toolbar->standardButton('download', 'COM_ACTIONLOGS_EXPORT_ALL_CSV', 'actionlogs.exportLogs')
+ ->icon('icon-download')
+ ->listCheck(false);
+
+ $toolbar->delete('actionlogs.delete')
+ ->message('JGLOBAL_CONFIRM_DELETE');
+
+ $toolbar->confirmButton('delete', 'COM_ACTIONLOGS_TOOLBAR_PURGE', 'actionlogs.purge')
+ ->message('COM_ACTIONLOGS_PURGE_CONFIRM')
+ ->listCheck(false);
+
+ $toolbar->preferences('com_actionlogs');
+ $toolbar->help('User_Actions_Log');
}
}
diff --git a/administrator/components/com_admin/src/View/Sysinfo/HtmlView.php b/administrator/components/com_admin/src/View/Sysinfo/HtmlView.php
index 741cc0131a24e..3b915c8c257b5 100644
--- a/administrator/components/com_admin/src/View/Sysinfo/HtmlView.php
+++ b/administrator/components/com_admin/src/View/Sysinfo/HtmlView.php
@@ -16,6 +16,7 @@
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Session\Session;
+use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\Component\Admin\Administrator\Model\SysinfoModel;
@@ -111,16 +112,13 @@ public function display($tpl = null): void
protected function addToolbar(): void
{
ToolbarHelper::title(Text::_('COM_ADMIN_SYSTEM_INFORMATION'), 'info-circle systeminfo');
- ToolbarHelper::link(
- Route::_('index.php?option=com_admin&view=sysinfo&format=text&' . Session::getFormToken() . '=1'),
- 'COM_ADMIN_DOWNLOAD_SYSTEM_INFORMATION_TEXT',
- 'download'
- );
- ToolbarHelper::link(
- Route::_('index.php?option=com_admin&view=sysinfo&format=json&' . Session::getFormToken() . '=1'),
- 'COM_ADMIN_DOWNLOAD_SYSTEM_INFORMATION_JSON',
- 'download'
- );
- ToolbarHelper::help('Site_System_Information');
+ $toolbar = Toolbar::getInstance();
+ $toolbar->linkButton('download', 'COM_ADMIN_DOWNLOAD_SYSTEM_INFORMATION_TEXT')
+ ->url(Route::_('index.php?option=com_admin&view=sysinfo&format=text&' . Session::getFormToken() . '=1'));
+
+ $toolbar->linkButton('download', 'COM_ADMIN_DOWNLOAD_SYSTEM_INFORMATION_JSON')
+ ->url(Route::_('index.php?option=com_admin&view=sysinfo&format=json&' . Session::getFormToken() . '=1'));
+
+ $toolbar->help('Site_System_Information');
}
}
diff --git a/administrator/components/com_associations/src/View/Association/HtmlView.php b/administrator/components/com_associations/src/View/Association/HtmlView.php
index fa9e24a01d1a3..8b6409f76c69a 100644
--- a/administrator/components/com_associations/src/View/Association/HtmlView.php
+++ b/administrator/components/com_associations/src/View/Association/HtmlView.php
@@ -359,29 +359,24 @@ protected function addToolbar(): void
'language assoc'
);
- $bar = Toolbar::getInstance();
-
- $bar->appendButton(
- 'Custom',
- '');
- $bar->appendButton(
- 'Custom',
- 'customButton('target')
+ ->html(''
- . Text::_('COM_ASSOCIATIONS_SAVE_TARGET') . '',
- 'target'
- );
+ . Text::_('COM_ASSOCIATIONS_SAVE_TARGET') . '');
if ($this->typeName === 'category' || $this->extensionName === 'com_menus' || $this->save2copy === true) {
- ToolbarHelper::custom('copy', 'copy.png', '', 'COM_ASSOCIATIONS_COPY_REFERENCE', false);
+ $toolbar->standardButton('', 'COM_ASSOCIATIONS_COPY_REFERENCE', 'copy')
+ ->icon('icon-copy')
+ ->listCheck(false);
}
- ToolbarHelper::cancel('association.cancel', 'JTOOLBAR_CLOSE');
- ToolbarHelper::help('Multilingual_Associations:_Edit');
+ $toolbar->cancel('association.cancel');
+ $toolbar->help('Multilingual_Associations:_Edit');
}
}
diff --git a/administrator/components/com_associations/src/View/Associations/HtmlView.php b/administrator/components/com_associations/src/View/Associations/HtmlView.php
index 5b7ffe0255937..bd309595a0ee4 100644
--- a/administrator/components/com_associations/src/View/Associations/HtmlView.php
+++ b/administrator/components/com_associations/src/View/Associations/HtmlView.php
@@ -15,6 +15,7 @@
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Router\Route;
+use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\Component\Associations\Administrator\Helper\AssociationsHelper;
@@ -217,15 +218,21 @@ protected function addToolbar()
ToolbarHelper::title(Text::_('COM_ASSOCIATIONS_TITLE_LIST_SELECT'), 'language assoc');
}
+ $toolbar = Toolbar::getInstance();
+
if ($user->authorise('core.admin', 'com_associations') || $user->authorise('core.options', 'com_associations')) {
if (!isset($this->typeName)) {
- ToolbarHelper::custom('associations.purge', 'purge', '', 'COM_ASSOCIATIONS_PURGE', false, false);
- ToolbarHelper::custom('associations.clean', 'refresh', '', 'COM_ASSOCIATIONS_DELETE_ORPHANS', false, false);
+ $toolbar->standardButton('', 'COM_ASSOCIATIONS_PURGE', 'associations.purge')
+ ->icon('icon-purge')
+ ->listCheck(false);
+ $toolbar->standardButton('', 'COM_ASSOCIATIONS_DELETE_ORPHANS', 'associations.clean')
+ ->icon('icon-refresh')
+ ->listCheck(false);
}
- ToolbarHelper::preferences('com_associations');
+ $toolbar->preferences('com_associations');
}
- ToolbarHelper::help('Multilingual_Associations');
+ $toolbar->help('Multilingual_Associations');
}
}
diff --git a/administrator/components/com_banners/src/View/Banner/HtmlView.php b/administrator/components/com_banners/src/View/Banner/HtmlView.php
index 6cefffd3b7935..2072be8c75867 100644
--- a/administrator/components/com_banners/src/View/Banner/HtmlView.php
+++ b/administrator/components/com_banners/src/View/Banner/HtmlView.php
@@ -18,6 +18,7 @@
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
+use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\Component\Banners\Administrator\Model\BannerModel;
@@ -101,45 +102,49 @@ protected function addToolbar(): void
$userId = $user->id;
$isNew = ($this->item->id == 0);
$checkedOut = !(\is_null($this->item->checked_out) || $this->item->checked_out == $userId);
+ $toolbar = Toolbar::getInstance();
// Since we don't track these assets at the item level, use the category id.
$canDo = ContentHelper::getActions('com_banners', 'category', $this->item->catid);
ToolbarHelper::title($isNew ? Text::_('COM_BANNERS_MANAGER_BANNER_NEW') : Text::_('COM_BANNERS_MANAGER_BANNER_EDIT'), 'bookmark banners');
- $toolbarButtons = [];
-
// If not checked out, can save the item.
if (!$checkedOut && ($canDo->get('core.edit') || \count($user->getAuthorisedCategories('com_banners', 'core.create')) > 0)) {
- ToolbarHelper::apply('banner.apply');
- $toolbarButtons[] = ['save', 'banner.save'];
-
- if ($canDo->get('core.create')) {
- $toolbarButtons[] = ['save2new', 'banner.save2new'];
- }
+ $toolbar->apply('banner.apply');
}
- // If an existing item, can save to a copy.
- if (!$isNew && $canDo->get('core.create')) {
- $toolbarButtons[] = ['save2copy', 'banner.save2copy'];
- }
+ $saveGroup = $toolbar->dropdownButton('save-group');
- ToolbarHelper::saveGroup(
- $toolbarButtons,
- 'btn-success'
+ $saveGroup->configure(
+ function (Toolbar $childBar) use ($checkedOut, $canDo, $user, $isNew) {
+ // If not checked out, can save the item.
+ if (!$checkedOut && ($canDo->get('core.edit') || \count($user->getAuthorisedCategories('com_banners', 'core.create')) > 0)) {
+ $childBar->save('banner.save');
+
+ if ($canDo->get('core.create')) {
+ $childBar->save2new('banner.save2new');
+ }
+ }
+
+ // If an existing item, can save to a copy.
+ if (!$isNew && $canDo->get('core.create')) {
+ $childBar->save2copy('banner.save2copy');
+ }
+ }
);
if (empty($this->item->id)) {
- ToolbarHelper::cancel('banner.cancel');
+ $toolbar->cancel('banner.cancel', 'JTOOLBAR_CANCEL');
} else {
- ToolbarHelper::cancel('banner.cancel', 'JTOOLBAR_CLOSE');
+ $toolbar->cancel('banner.cancel');
if (ComponentHelper::isEnabled('com_contenthistory') && $this->state->params->get('save_history', 0) && $canDo->get('core.edit')) {
- ToolbarHelper::versions('com_banners.banner', $this->item->id);
+ $toolbar->versions('com_banners.banner', $this->item->id);
}
}
- ToolbarHelper::divider();
- ToolbarHelper::help('Banners:_Edit');
+ $toolbar->divider();
+ $toolbar->help('Banners:_Edit');
}
}
diff --git a/administrator/components/com_banners/src/View/Banners/HtmlView.php b/administrator/components/com_banners/src/View/Banners/HtmlView.php
index 461cf0db71971..4d47c5dc1ffda 100644
--- a/administrator/components/com_banners/src/View/Banners/HtmlView.php
+++ b/administrator/components/com_banners/src/View/Banners/HtmlView.php
@@ -19,6 +19,7 @@
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Pagination\Pagination;
+use Joomla\CMS\Toolbar\Button\DropdownButton;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\Component\Banners\Administrator\Model\BannersModel;
@@ -141,11 +142,9 @@ public function display($tpl = null): void
*/
protected function addToolbar(): void
{
- $canDo = ContentHelper::getActions('com_banners', 'category', $this->state->get('filter.category_id'));
- $user = Factory::getApplication()->getIdentity();
-
- // Get the toolbar object instance
- $toolbar = Toolbar::getInstance('toolbar');
+ $canDo = ContentHelper::getActions('com_banners', 'category', $this->state->get('filter.category_id'));
+ $user = Factory::getApplication()->getIdentity();
+ $toolbar = Toolbar::getInstance();
ToolbarHelper::title(Text::_('COM_BANNERS_MANAGER_BANNERS'), 'bookmark banners');
@@ -154,8 +153,8 @@ protected function addToolbar(): void
}
if (!$this->isEmptyState && ($canDo->get('core.edit.state') || ($this->state->get('filter.published') == -2 && $canDo->get('core.delete')))) {
- $dropdown = $toolbar->dropdownButton('status-group')
- ->text('JTOOLBAR_CHANGE_STATUS')
+ /** @var DropdownButton $dropdown */
+ $dropdown = $toolbar->dropdownButton('status-group', 'JTOOLBAR_CHANGE_STATUS')
->toggleSplit(false)
->icon('icon-ellipsis-h')
->buttonClass('btn btn-action')
@@ -178,7 +177,7 @@ protected function addToolbar(): void
}
}
- $childBar->checkin('banners.checkin')->listCheck(true);
+ $childBar->checkin('banners.checkin');
if ($this->state->get('filter.published') != -2) {
$childBar->trash('banners.trash')->listCheck(true);
@@ -186,8 +185,7 @@ protected function addToolbar(): void
}
if ($this->state->get('filter.published') == -2 && $canDo->get('core.delete')) {
- $toolbar->delete('banners.delete')
- ->text('JTOOLBAR_EMPTY_TRASH')
+ $toolbar->delete('banners.delete', 'JTOOLBAR_EMPTY_TRASH')
->message('JGLOBAL_CONFIRM_DELETE')
->listCheck(true);
}
@@ -198,8 +196,7 @@ protected function addToolbar(): void
&& $user->authorise('core.edit', 'com_banners')
&& $user->authorise('core.edit.state', 'com_banners')
) {
- $childBar->popupButton('batch')
- ->text('JTOOLBAR_BATCH')
+ $childBar->popupButton('batch', 'JTOOLBAR_BATCH')
->selector('collapseModal')
->listCheck(true);
}
diff --git a/administrator/components/com_banners/src/View/Client/HtmlView.php b/administrator/components/com_banners/src/View/Client/HtmlView.php
index 9b9048a131b4c..b95de433a3cca 100644
--- a/administrator/components/com_banners/src/View/Client/HtmlView.php
+++ b/administrator/components/com_banners/src/View/Client/HtmlView.php
@@ -19,6 +19,7 @@
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Object\CMSObject;
+use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\Component\Banners\Administrator\Model\ClientModel;
@@ -112,6 +113,7 @@ protected function addToolbar(): void
$isNew = ($this->item->id == 0);
$checkedOut = !(\is_null($this->item->checked_out) || $this->item->checked_out == $user->id);
$canDo = $this->canDo;
+ $toolbar = Toolbar::getInstance();
ToolbarHelper::title(
$isNew ? Text::_('COM_BANNERS_MANAGER_CLIENT_NEW') : Text::_('COM_BANNERS_MANAGER_CLIENT_EDIT'),
@@ -122,35 +124,39 @@ protected function addToolbar(): void
// If not checked out, can save the item.
if (!$checkedOut && ($canDo->get('core.edit') || $canDo->get('core.create'))) {
- ToolbarHelper::apply('client.apply');
- $toolbarButtons[] = ['save', 'client.save'];
+ $toolbar->apply('client.apply');
}
- if (!$checkedOut && $canDo->get('core.create')) {
- $toolbarButtons[] = ['save2new', 'client.save2new'];
- }
-
- // If an existing item, can save to a copy.
- if (!$isNew && $canDo->get('core.create')) {
- $toolbarButtons[] = ['save2copy', 'client.save2copy'];
- }
-
- ToolbarHelper::saveGroup(
- $toolbarButtons,
- 'btn-success'
+ $saveGroup = $toolbar->dropdownButton('save-group');
+ $saveGroup->configure(
+ function (Toolbar $childBar) use ($checkedOut, $canDo, $isNew) {
+ // If not checked out, can save the item.
+ if (!$checkedOut && ($canDo->get('core.edit') || $canDo->get('core.create'))) {
+ $childBar->save('client.save');
+ }
+
+ if (!$checkedOut && $canDo->get('core.create')) {
+ $childBar->save2new('client.save2new');
+ }
+
+ // If an existing item, can save to a copy.
+ if (!$isNew && $canDo->get('core.create')) {
+ $childBar->save2copy('client.save2copy');
+ }
+ }
);
if (empty($this->item->id)) {
- ToolbarHelper::cancel('client.cancel');
+ $toolbar->cancel('client.cancel', 'JTOOLBAR_CANCEL');
} else {
- ToolbarHelper::cancel('client.cancel', 'JTOOLBAR_CLOSE');
+ $toolbar->cancel('client.cancel');
if (ComponentHelper::isEnabled('com_contenthistory') && $this->state->params->get('save_history', 0) && $canDo->get('core.edit')) {
- ToolbarHelper::versions('com_banners.client', $this->item->id);
+ $toolbar->versions('com_banners.client', $this->item->id);
}
}
- ToolbarHelper::divider();
- ToolbarHelper::help('Banners:_New_or_Edit_Client');
+ $toolbar->divider();
+ $toolbar->help('Banners:_New_or_Edit_Client');
}
}
diff --git a/administrator/components/com_banners/src/View/Clients/HtmlView.php b/administrator/components/com_banners/src/View/Clients/HtmlView.php
index 01f283c1c8e06..9f18a5ad8418e 100644
--- a/administrator/components/com_banners/src/View/Clients/HtmlView.php
+++ b/administrator/components/com_banners/src/View/Clients/HtmlView.php
@@ -125,20 +125,17 @@ public function display($tpl = null): void
*/
protected function addToolbar(): void
{
- $canDo = ContentHelper::getActions('com_banners');
+ $canDo = ContentHelper::getActions('com_banners');
+ $toolbar = Toolbar::getInstance();
ToolbarHelper::title(Text::_('COM_BANNERS_MANAGER_CLIENTS'), 'bookmark banners-clients');
- // Get the toolbar object instance
- $toolbar = Toolbar::getInstance('toolbar');
-
if ($canDo->get('core.create')) {
$toolbar->addNew('client.add');
}
if (!$this->isEmptyState && ($canDo->get('core.edit.state') || $canDo->get('core.admin'))) {
- $dropdown = $toolbar->dropdownButton('status-group')
- ->text('JTOOLBAR_CHANGE_STATUS')
+ $dropdown = $toolbar->dropdownButton('status-group', 'JTOOLBAR_CHANGE_STATUS')
->toggleSplit(false)
->icon('icon-ellipsis-h')
->buttonClass('btn btn-action')
@@ -160,8 +157,7 @@ protected function addToolbar(): void
}
if (!$this->isEmptyState && $this->state->get('filter.state') == -2 && $canDo->get('core.delete')) {
- $toolbar->delete('clients.delete')
- ->text('JTOOLBAR_EMPTY_TRASH')
+ $toolbar->delete('clients.delete', 'JTOOLBAR_EMPTY_TRASH')
->message('JGLOBAL_CONFIRM_DELETE')
->listCheck(true);
}
diff --git a/administrator/components/com_banners/src/View/Tracks/HtmlView.php b/administrator/components/com_banners/src/View/Tracks/HtmlView.php
index dab4bc3ff7342..65929ca329c85 100644
--- a/administrator/components/com_banners/src/View/Tracks/HtmlView.php
+++ b/administrator/components/com_banners/src/View/Tracks/HtmlView.php
@@ -126,13 +126,12 @@ public function display($tpl = null): void
protected function addToolbar(): void
{
$canDo = ContentHelper::getActions('com_banners', 'category', $this->state->get('filter.category_id'));
+ $toolbar = Toolbar::getInstance();
ToolbarHelper::title(Text::_('COM_BANNERS_MANAGER_TRACKS'), 'bookmark banners-tracks');
- $bar = Toolbar::getInstance('toolbar');
-
if (!$this->isEmptyState) {
- $bar->popupButton()
+ $toolbar->popupButton()
->url(Route::_('index.php?option=com_banners&view=download&tmpl=component'))
->text('JTOOLBAR_EXPORT')
->selector('downloadModal')
@@ -146,13 +145,15 @@ protected function addToolbar(): void
}
if (!$this->isEmptyState && $canDo->get('core.delete')) {
- $bar->appendButton('Confirm', 'COM_BANNERS_DELETE_MSG', 'delete', 'COM_BANNERS_TRACKS_DELETE', 'tracks.delete', false);
+ $toolbar->delete('tracks.delete', 'COM_BANNERS_TRACKS_DELETE')
+ ->message('COM_BANNERS_DELETE_MSG')
+ ->listCheck(false);
}
if ($canDo->get('core.admin') || $canDo->get('core.options')) {
- ToolbarHelper::preferences('com_banners');
+ $toolbar->preferences('com_banners');
}
- ToolbarHelper::help('Banners:_Tracks');
+ $toolbar->help('Banners:_Tracks');
}
}
diff --git a/administrator/components/com_cache/src/View/Cache/HtmlView.php b/administrator/components/com_cache/src/View/Cache/HtmlView.php
index 2041d4b744f99..a121f9fefd56d 100644
--- a/administrator/components/com_cache/src/View/Cache/HtmlView.php
+++ b/administrator/components/com_cache/src/View/Cache/HtmlView.php
@@ -11,7 +11,6 @@
\defined('_JEXEC') or die;
-use Joomla\CMS\Factory;
use Joomla\CMS\Form\Form;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\GenericDataException;
@@ -131,18 +130,27 @@ protected function addToolbar(): void
if (\count($this->data))
{
- ToolbarHelper::custom('delete', 'delete', '', 'JTOOLBAR_DELETE', true);
- ToolbarHelper::custom('deleteAll', 'remove', '', 'JTOOLBAR_DELETE_ALL', false);
- $toolbar->appendButton('Confirm', 'COM_CACHE_RESOURCE_INTENSIVE_WARNING', 'delete', 'COM_CACHE_PURGE_EXPIRED', 'purge', false);
- ToolbarHelper::divider();
+ $toolbar->delete('delete')
+ ->listCheck(true);
+
+ $toolbar->confirmButton('delete', 'JTOOLBAR_DELETE_ALL', 'deleteAll')
+ ->icon('icon-remove')
+ ->listCheck(false)
+ ->buttonClass('button-remove btn btn-primary');
+
+ $toolbar->confirmButton('delete', 'COM_CACHE_PURGE_EXPIRED', 'purge')
+ ->name('delete')
+ ->message('COM_CACHE_RESOURCE_INTENSIVE_WARNING');
+
+ $toolbar->divider();
}
if ($this->getCurrentUser()->authorise('core.admin', 'com_cache'))
{
- ToolbarHelper::preferences('com_cache');
- ToolbarHelper::divider();
+ $toolbar->preferences('com_cache');
+ $toolbar->divider();
}
- ToolbarHelper::help('Maintenance:_Clear_Cache');
+ $toolbar->help('Maintenance:_Clear_Cache');
}
}
diff --git a/administrator/components/com_categories/src/View/Categories/HtmlView.php b/administrator/components/com_categories/src/View/Categories/HtmlView.php
index 6df0056a50174..74a52a018f73c 100644
--- a/administrator/components/com_categories/src/View/Categories/HtmlView.php
+++ b/administrator/components/com_categories/src/View/Categories/HtmlView.php
@@ -19,6 +19,7 @@
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Pagination\Pagination;
+use Joomla\CMS\Toolbar\Button\DropdownButton;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
@@ -155,9 +156,7 @@ protected function addToolbar()
$section = $this->state->get('filter.section');
$canDo = ContentHelper::getActions($component, 'category', $categoryId);
$user = Factory::getApplication()->getIdentity();
-
- // Get the toolbar object instance
- $toolbar = Toolbar::getInstance('toolbar');
+ $toolbar = Toolbar::getInstance();
// Avoid nonsense situation.
if ($component == 'com_categories') {
@@ -199,8 +198,8 @@ protected function addToolbar()
}
if (!$this->isEmptyState && ($canDo->get('core.edit.state') || $user->authorise('core.admin'))) {
- $dropdown = $toolbar->dropdownButton('status-group')
- ->text('JTOOLBAR_CHANGE_STATUS')
+ /** @var DropdownButton $dropdown */
+ $dropdown = $toolbar->dropdownButton('status-group', 'JTOOLBAR_CHANGE_STATUS')
->toggleSplit(false)
->icon('icon-ellipsis-h')
->buttonClass('btn btn-action')
@@ -217,7 +216,7 @@ protected function addToolbar()
}
if ($user->authorise('core.admin')) {
- $childBar->checkin('categories.checkin')->listCheck(true);
+ $childBar->checkin('categories.checkin');
}
if ($canDo->get('core.edit.state') && $this->state->get('filter.published') != -2) {
@@ -230,22 +229,19 @@ protected function addToolbar()
&& $canDo->get('core.edit')
&& $canDo->get('core.edit.state')
) {
- $childBar->popupButton('batch')
- ->text('JTOOLBAR_BATCH')
+ $childBar->popupButton('batch', 'JTOOLBAR_BATCH')
->selector('collapseModal')
->listCheck(true);
}
}
if (!$this->isEmptyState && $canDo->get('core.admin')) {
- $toolbar->standardButton('refresh')
- ->text('JTOOLBAR_REBUILD')
+ $toolbar->standardButton('refresh', 'JTOOLBAR_REBUILD')
->task('categories.rebuild');
}
if (!$this->isEmptyState && $this->state->get('filter.published') == -2 && $canDo->get('core.delete', $component)) {
- $toolbar->delete('categories.delete')
- ->text('JTOOLBAR_EMPTY_TRASH')
+ $toolbar->delete('categories.delete', 'JTOOLBAR_EMPTY_TRASH')
->message('JGLOBAL_CONFIRM_DELETE')
->listCheck(true);
}
@@ -308,6 +304,6 @@ protected function addToolbar()
}
}
- ToolbarHelper::help($ref_key, ComponentHelper::getParams($component)->exists('helpURL'), $url);
+ $toolbar->help($ref_key, ComponentHelper::getParams($component)->exists('helpURL'), $url);
}
}
diff --git a/administrator/components/com_categories/src/View/Category/HtmlView.php b/administrator/components/com_categories/src/View/Category/HtmlView.php
index ddf9be928ae40..ffe203257bcfe 100644
--- a/administrator/components/com_categories/src/View/Category/HtmlView.php
+++ b/administrator/components/com_categories/src/View/Category/HtmlView.php
@@ -19,6 +19,7 @@
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Object\CMSObject;
+use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\Component\Associations\Administrator\Helper\AssociationsHelper;
@@ -132,8 +133,9 @@ public function display($tpl = null)
protected function addToolbar()
{
$extension = Factory::getApplication()->getInput()->get('extension');
- $user = $this->getCurrentUser();
- $userId = $user->id;
+ $user = $this->getCurrentUser();
+ $userId = $user->id;
+ $toolbar = Toolbar::getInstance();
$isNew = ($this->item->id == 0);
$checkedOut = !(is_null($this->item->checked_out) || $this->item->checked_out == $userId);
@@ -189,49 +191,52 @@ protected function addToolbar()
// For new records, check the create permission.
if ($isNew && (count($user->getAuthorisedCategories($component, 'core.create')) > 0)) {
- ToolbarHelper::apply('category.apply');
- ToolbarHelper::saveGroup(
- [
- ['save', 'category.save'],
- ['save2new', 'category.save2new']
- ],
- 'btn-success'
+ $toolbar->apply('category.apply');
+ $saveGroup = $toolbar->dropdownButton('save-group');
+
+ $saveGroup->configure(
+ function (Toolbar $childBar) {
+ $childBar->save('category.save');
+ $childBar->save('category.save2new');
+ }
);
- ToolbarHelper::cancel('category.cancel');
+ $toolbar->cancel('category.cancel');
} else {
// If not checked out, can save the item.
// Since it's an existing record, check the edit permission, or fall back to edit own if the owner.
$itemEditable = $canDo->get('core.edit') || ($canDo->get('core.edit.own') && $this->item->created_user_id == $userId);
- $toolbarButtons = [];
-
// Can't save the record if it's checked out and editable
if (!$checkedOut && $itemEditable) {
- ToolbarHelper::apply('category.apply');
+ $toolbar->apply('category.apply');
+ }
- $toolbarButtons[] = ['save', 'category.save'];
+ $saveGroup = $toolbar->dropdownButton('save-group');
- if ($canDo->get('core.create')) {
- $toolbarButtons[] = ['save2new', 'category.save2new'];
- }
- }
+ $saveGroup->configure(
+ function (Toolbar $childBar) use ($checkedOut, $canDo, $itemEditable) {
+ // Can't save the record if it's checked out and editable
+ if (!$checkedOut && $itemEditable) {
+ $childBar->save('category.save');
- // If an existing item, can save to a copy.
- if ($canDo->get('core.create')) {
- $toolbarButtons[] = ['save2copy', 'category.save2copy'];
- }
+ if ($canDo->get('core.create')) {
+ $childBar->save2new('category.save2new');
+ }
+ }
- ToolbarHelper::saveGroup(
- $toolbarButtons,
- 'btn-success'
+ // If an existing item, can save to a copy.
+ if ($canDo->get('core.create')) {
+ $childBar->save2copy('category.save2copy');
+ }
+ }
);
- ToolbarHelper::cancel('category.cancel', 'JTOOLBAR_CLOSE');
+ $toolbar->cancel('category.cancel');
if (ComponentHelper::isEnabled('com_contenthistory') && $componentParams->get('save_history', 0) && $itemEditable) {
$typeAlias = $extension . '.category';
- ToolbarHelper::versions($typeAlias, $this->item->id);
+ $toolbar->versions($typeAlias, $this->item->id);
}
if (
@@ -239,11 +244,13 @@ protected function addToolbar()
ComponentHelper::isEnabled('com_associations') &&
AssociationsHelper::hasSupport($component)
) {
- ToolbarHelper::custom('category.editAssociations', 'contract', '', 'JTOOLBAR_ASSOCIATIONS', false, false);
+ $toolbar->standardButton('contract', 'JTOOLBAR_ASSOCIATIONS', 'category.editAssociations')
+ ->icon('icon-contract')
+ ->listCheck(false);
}
}
- ToolbarHelper::divider();
+ $toolbar->divider();
// Look first in form for help key
$ref_key = (string) $this->form->getXml()->help['key'];
@@ -283,6 +290,6 @@ protected function addToolbar()
}
}
- ToolbarHelper::help($ref_key, $componentParams->exists('helpURL'), $url, $component);
+ $toolbar->help($ref_key, $componentParams->exists('helpURL'), $url, $component);
}
}
diff --git a/administrator/components/com_checkin/src/View/Checkin/HtmlView.php b/administrator/components/com_checkin/src/View/Checkin/HtmlView.php
index c0e05b0ec46ef..cec62a90a8e20 100644
--- a/administrator/components/com_checkin/src/View/Checkin/HtmlView.php
+++ b/administrator/components/com_checkin/src/View/Checkin/HtmlView.php
@@ -14,6 +14,7 @@
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
+use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
// phpcs:disable PSR1.Files.SideEffects
@@ -116,17 +117,18 @@ public function display($tpl = null)
protected function addToolbar()
{
ToolbarHelper::title(Text::_('COM_CHECKIN_GLOBAL_CHECK_IN'), 'check-square');
+ $toolbar = Toolbar::getInstance();
if (!$this->isEmptyState) {
- ToolbarHelper::custom('checkin', 'checkin', '', 'JTOOLBAR_CHECKIN', true);
+ $toolbar->checkin('checkin');
}
if (Factory::getApplication()->getIdentity()->authorise('core.admin', 'com_checkin')) {
- ToolbarHelper::divider();
- ToolbarHelper::preferences('com_checkin');
- ToolbarHelper::divider();
+ $toolbar->divider();
+ $toolbar->preferences('com_checkin');
+ $toolbar->divider();
}
- ToolbarHelper::help('Maintenance:_Global_Check-in');
+ $toolbar->help('Maintenance:_Global_Check-in');
}
}
diff --git a/administrator/components/com_config/src/View/Application/HtmlView.php b/administrator/components/com_config/src/View/Application/HtmlView.php
index a3cda98565105..eacd5f6c44e82 100644
--- a/administrator/components/com_config/src/View/Application/HtmlView.php
+++ b/administrator/components/com_config/src/View/Application/HtmlView.php
@@ -14,6 +14,7 @@
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
+use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\Component\Config\Administrator\Helper\ConfigHelper;
@@ -109,14 +110,16 @@ public function display($tpl = null)
*/
protected function addToolbar()
{
+ $toolbar = Toolbar::getInstance();
+
ToolbarHelper::title(Text::_('COM_CONFIG_GLOBAL_CONFIGURATION'), 'cog config');
- ToolbarHelper::apply('application.apply');
- ToolbarHelper::divider();
- ToolbarHelper::save('application.save');
- ToolbarHelper::divider();
- ToolbarHelper::cancel('application.cancel', 'JTOOLBAR_CLOSE');
- ToolbarHelper::divider();
- ToolbarHelper::inlinehelp();
- ToolbarHelper::help('Site_Global_Configuration');
+ $toolbar->apply('application.apply');
+ $toolbar->divider();
+ $toolbar->save('application.save');
+ $toolbar->divider();
+ $toolbar->cancel('application.cancel');
+ $toolbar->divider();
+ $toolbar->inlinehelp();
+ $toolbar->help('Site_Global_Configuration');
}
}
diff --git a/administrator/components/com_config/src/View/Component/HtmlView.php b/administrator/components/com_config/src/View/Component/HtmlView.php
index fb3e44fe7e228..d2a52e50c8276 100644
--- a/administrator/components/com_config/src/View/Component/HtmlView.php
+++ b/administrator/components/com_config/src/View/Component/HtmlView.php
@@ -13,6 +13,7 @@
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
+use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\Component\Config\Administrator\Helper\ConfigHelper;
@@ -109,19 +110,21 @@ public function display($tpl = null)
*/
protected function addToolbar()
{
+ $toolbar = Toolbar::getInstance();
+
ToolbarHelper::title(Text::_($this->component->option . '_configuration'), 'cog config');
- ToolbarHelper::apply('component.apply');
- ToolbarHelper::divider();
- ToolbarHelper::save('component.save');
- ToolbarHelper::divider();
- ToolbarHelper::cancel('component.cancel', 'JTOOLBAR_CLOSE');
- ToolbarHelper::divider();
+ $toolbar->apply('component.apply');
+ $toolbar->divider();
+ $toolbar->save('component.save');
+ $toolbar->divider();
+ $toolbar->cancel('component.cancel');
+ $toolbar->divider();
$inlinehelp = (string) $this->form->getXml()->config->inlinehelp['button'] == 'show' ?: false;
$targetClass = (string) $this->form->getXml()->config->inlinehelp['targetclass'] ?: 'hide-aware-inline-help';
if ($inlinehelp) {
- ToolbarHelper::inlinehelp($targetClass);
+ $toolbar->inlinehelp($targetClass);
}
$helpUrl = $this->form->getData()->get('helpURL');
@@ -137,6 +140,6 @@ protected function addToolbar()
}
}
- ToolbarHelper::help($helpKey, (bool) $helpUrl, null, $this->currentComponent);
+ $toolbar->help($helpKey, (bool) $helpUrl, null, $this->currentComponent);
}
}
diff --git a/administrator/components/com_contact/src/View/Contact/HtmlView.php b/administrator/components/com_contact/src/View/Contact/HtmlView.php
index 6887d4f2df237..137683bd4bdb9 100644
--- a/administrator/components/com_contact/src/View/Contact/HtmlView.php
+++ b/administrator/components/com_contact/src/View/Contact/HtmlView.php
@@ -104,19 +104,18 @@ protected function addToolbar()
$userId = $user->id;
$isNew = ($this->item->id == 0);
$checkedOut = !(is_null($this->item->checked_out) || $this->item->checked_out == $userId);
+ $toolbar = Toolbar::getInstance();
// Since we don't track these assets at the item level, use the category id.
$canDo = ContentHelper::getActions('com_contact', 'category', $this->item->catid);
- $toolbar = Toolbar::getInstance();
-
ToolbarHelper::title($isNew ? Text::_('COM_CONTACT_MANAGER_CONTACT_NEW') : Text::_('COM_CONTACT_MANAGER_CONTACT_EDIT'), 'address-book contact');
// Build the actions for new and existing records.
if ($isNew) {
// For new records, check the create permission.
if (count($user->getAuthorisedCategories('com_contact', 'core.create')) > 0) {
- ToolbarHelper::apply('contact.apply');
+ $toolbar->apply('contact.apply');
$saveGroup = $toolbar->dropdownButton('save-group');
@@ -133,7 +132,7 @@ function (Toolbar $childBar) use ($user) {
);
}
- ToolbarHelper::cancel('contact.cancel');
+ $toolbar->cancel('contact.cancel');
} else {
// Since it's an existing record, check the edit permission, or fall back to edit own if the owner.
$itemEditable = $canDo->get('core.edit') || ($canDo->get('core.edit.own') && $this->item->created_by == $userId);
@@ -169,18 +168,20 @@ function (Toolbar $childBar) use ($checkedOut, $itemEditable, $canDo, $user) {
}
);
- ToolbarHelper::cancel('contact.cancel', 'JTOOLBAR_CLOSE');
+ $toolbar->cancel('contact.cancel');
if (ComponentHelper::isEnabled('com_contenthistory') && $this->state->params->get('save_history', 0) && $itemEditable) {
- ToolbarHelper::versions('com_contact.contact', $this->item->id);
+ $toolbar->versions('com_contact.contact', $this->item->id);
}
if (Associations::isEnabled() && ComponentHelper::isEnabled('com_associations')) {
- ToolbarHelper::custom('contact.editAssociations', 'contract', '', 'JTOOLBAR_ASSOCIATIONS', false, false);
+ $toolbar->standardButton('contract', 'JTOOLBAR_ASSOCIATIONS', 'contact.editAssociations')
+ ->icon('icon-contract')
+ ->listCheck(false);
}
}
- ToolbarHelper::divider();
- ToolbarHelper::help('Contacts:_New_or_Edit');
+ $toolbar->divider();
+ $toolbar->help('Contacts:_New_or_Edit');
}
}
diff --git a/administrator/components/com_contact/src/View/Contacts/HtmlView.php b/administrator/components/com_contact/src/View/Contacts/HtmlView.php
index fdc08ad9a0920..244d95ab3bdd7 100644
--- a/administrator/components/com_contact/src/View/Contacts/HtmlView.php
+++ b/administrator/components/com_contact/src/View/Contacts/HtmlView.php
@@ -16,6 +16,7 @@
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
+use Joomla\CMS\Toolbar\Button\DropdownButton;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
@@ -146,7 +147,7 @@ protected function addToolbar()
$user = Factory::getApplication()->getIdentity();
// Get the toolbar object instance
- $toolbar = Toolbar::getInstance('toolbar');
+ $toolbar = Toolbar::getInstance();
ToolbarHelper::title(Text::_('COM_CONTACT_MANAGER_CONTACTS'), 'address-book contact');
@@ -155,8 +156,8 @@ protected function addToolbar()
}
if (!$this->isEmptyState && $canDo->get('core.edit.state')) {
- $dropdown = $toolbar->dropdownButton('status-group')
- ->text('JTOOLBAR_CHANGE_STATUS')
+ /** @var DropdownButton $dropdown */
+ $dropdown = $toolbar->dropdownButton('status-group', 'JTOOLBAR_CHANGE_STATUS')
->toggleSplit(false)
->icon('icon-ellipsis-h')
->buttonClass('btn btn-action')
@@ -165,22 +166,15 @@ protected function addToolbar()
$childBar = $dropdown->getChildToolbar();
$childBar->publish('contacts.publish')->listCheck(true);
-
$childBar->unpublish('contacts.unpublish')->listCheck(true);
-
- $childBar->standardButton('featured')
- ->text('JFEATURE')
- ->task('contacts.featured')
+ $childBar->standardButton('featured', 'JFEATURE', 'contacts.featured')
->listCheck(true);
- $childBar->standardButton('unfeatured')
- ->text('JUNFEATURE')
- ->task('contacts.unfeatured')
+ $childBar->standardButton('unfeatured', 'JUNFEATURE', 'contacts.unfeatured')
->listCheck(true);
-
$childBar->archive('contacts.archive')->listCheck(true);
if ($user->authorise('core.admin')) {
- $childBar->checkin('contacts.checkin')->listCheck(true);
+ $childBar->checkin('contacts.checkin');
}
if ($this->state->get('filter.published') != -2) {
@@ -193,16 +187,14 @@ protected function addToolbar()
&& $user->authorise('core.edit', 'com_contact')
&& $user->authorise('core.edit.state', 'com_contact')
) {
- $childBar->popupButton('batch')
- ->text('JTOOLBAR_BATCH')
+ $childBar->popupButton('batch', 'JTOOLBAR_BATCH')
->selector('collapseModal')
->listCheck(true);
}
}
if (!$this->isEmptyState && $this->state->get('filter.published') == -2 && $canDo->get('core.delete')) {
- $toolbar->delete('contacts.delete')
- ->text('JTOOLBAR_EMPTY_TRASH')
+ $toolbar->delete('contacts.delete', 'JTOOLBAR_EMPTY_TRASH')
->message('JGLOBAL_CONFIRM_DELETE')
->listCheck(true);
}
diff --git a/administrator/components/com_content/src/View/Article/HtmlView.php b/administrator/components/com_content/src/View/Article/HtmlView.php
index 393e38cd5e974..88a63951296be 100644
--- a/administrator/components/com_content/src/View/Article/HtmlView.php
+++ b/administrator/components/com_content/src/View/Article/HtmlView.php
@@ -132,12 +132,11 @@ protected function addToolbar()
$userId = $user->id;
$isNew = ($this->item->id == 0);
$checkedOut = !(is_null($this->item->checked_out) || $this->item->checked_out == $userId);
+ $toolbar = Toolbar::getInstance();
// Built the actions for new and existing records.
$canDo = $this->canDo;
- $toolbar = Toolbar::getInstance();
-
ToolbarHelper::title(
Text::_('COM_CONTENT_PAGE_' . ($checkedOut ? 'VIEW_ARTICLE' : ($isNew ? 'ADD_ARTICLE' : 'EDIT_ARTICLE'))),
'pencil-alt article-add'
@@ -216,17 +215,15 @@ function (Toolbar $childBar) use ($checkedOut, $itemEditable, $canDo, $user) {
}
if (Associations::isEnabled() && ComponentHelper::isEnabled('com_associations')) {
- $toolbar->standardButton('contract')
- ->text('JTOOLBAR_ASSOCIATIONS')
- ->task('article.editAssociations');
+ $toolbar->standardButton('associations', 'JTOOLBAR_ASSOCIATIONS', 'article.editAssociations')
+ ->icon('icon-contract')
+ ->listCheck(false);
}
}
}
$toolbar->divider();
-
- ToolbarHelper::inlinehelp();
-
+ $toolbar->inlinehelp();
$toolbar->help('Articles:_Edit');
}
}
diff --git a/administrator/components/com_content/src/View/Articles/HtmlView.php b/administrator/components/com_content/src/View/Articles/HtmlView.php
index 2514a430f0ace..9d7645c18de27 100644
--- a/administrator/components/com_content/src/View/Articles/HtmlView.php
+++ b/administrator/components/com_content/src/View/Articles/HtmlView.php
@@ -17,6 +17,7 @@
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Plugin\PluginHelper;
+use Joomla\CMS\Toolbar\Button\DropdownButton;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\Component\Content\Administrator\Extension\ContentComponent;
@@ -152,11 +153,9 @@ public function display($tpl = null)
*/
protected function addToolbar()
{
- $canDo = ContentHelper::getActions('com_content', 'category', $this->state->get('filter.category_id'));
- $user = $this->getCurrentUser();
-
- // Get the toolbar object instance
- $toolbar = Toolbar::getInstance('toolbar');
+ $canDo = ContentHelper::getActions('com_content', 'category', $this->state->get('filter.category_id'));
+ $user = $this->getCurrentUser();
+ $toolbar = Toolbar::getInstance();
ToolbarHelper::title(Text::_('COM_CONTENT_ARTICLES_TITLE'), 'copy article');
@@ -165,6 +164,7 @@ protected function addToolbar()
}
if (!$this->isEmptyState && ($canDo->get('core.edit.state') || \count($this->transitions))) {
+ /** @var DropdownButton $dropdown */
$dropdown = $toolbar->dropdownButton('status-group')
->text('JTOOLBAR_CHANGE_STATUS')
->toggleSplit(false)
@@ -185,8 +185,7 @@ protected function addToolbar()
$cmd = 'if (document.adminForm.boxchecked.value == 0) { ' . $alert . ' } else { ' . $cmd . ' }';
foreach ($this->transitions as $transition) {
- $childBar->standardButton('transition')
- ->text($transition['text'])
+ $childBar->standardButton('transition', $transition['text'])
->buttonClass('transition-' . (int) $transition['value'])
->icon('icon-project-diagram')
->onclick('document.adminForm.transition_id.value=' . (int) $transition['value'] . ';' . $cmd);
@@ -200,19 +199,15 @@ protected function addToolbar()
$childBar->unpublish('articles.unpublish')->listCheck(true);
- $childBar->standardButton('featured')
- ->text('JFEATURE')
- ->task('articles.featured')
+ $childBar->standardButton('featured', 'JFEATURE', 'articles.featured')
->listCheck(true);
- $childBar->standardButton('unfeatured')
- ->text('JUNFEATURE')
- ->task('articles.unfeatured')
+ $childBar->standardButton('unfeatured', 'JUNFEATURE', 'articles.unfeatured')
->listCheck(true);
$childBar->archive('articles.archive')->listCheck(true);
- $childBar->checkin('articles.checkin')->listCheck(true);
+ $childBar->checkin('articles.checkin');
if ($this->state->get('filter.published') != ContentComponent::CONDITION_TRASHED) {
$childBar->trash('articles.trash')->listCheck(true);
@@ -225,16 +220,14 @@ protected function addToolbar()
&& $user->authorise('core.edit', 'com_content')
&& $user->authorise('core.execute.transition', 'com_content')
) {
- $childBar->popupButton('batch')
- ->text('JTOOLBAR_BATCH')
+ $childBar->popupButton('batch', 'JTOOLBAR_BATCH')
->selector('collapseModal')
->listCheck(true);
}
}
if (!$this->isEmptyState && $this->state->get('filter.published') == ContentComponent::CONDITION_TRASHED && $canDo->get('core.delete')) {
- $toolbar->delete('articles.delete')
- ->text('JTOOLBAR_EMPTY_TRASH')
+ $toolbar->delete('articles.delete', 'JTOOLBAR_EMPTY_TRASH')
->message('JGLOBAL_CONFIRM_DELETE')
->listCheck(true);
}
diff --git a/administrator/components/com_content/src/View/Featured/HtmlView.php b/administrator/components/com_content/src/View/Featured/HtmlView.php
index 413505cfaac42..aaa4b8a5d9972 100644
--- a/administrator/components/com_content/src/View/Featured/HtmlView.php
+++ b/administrator/components/com_content/src/View/Featured/HtmlView.php
@@ -17,6 +17,7 @@
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Plugin\PluginHelper;
+use Joomla\CMS\Toolbar\Button\DropdownButton;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\Component\Content\Administrator\Extension\ContentComponent;
@@ -135,11 +136,9 @@ public function display($tpl = null)
*/
protected function addToolbar()
{
- $canDo = ContentHelper::getActions('com_content', 'category', $this->state->get('filter.category_id'));
- $user = Factory::getApplication()->getIdentity();
-
- // Get the toolbar object instance
- $toolbar = Toolbar::getInstance('toolbar');
+ $canDo = ContentHelper::getActions('com_content', 'category', $this->state->get('filter.category_id'));
+ $user = Factory::getApplication()->getIdentity();
+ $toolbar = Toolbar::getInstance();
ToolbarHelper::title(Text::_('COM_CONTENT_FEATURED_TITLE'), 'star featured');
@@ -148,8 +147,8 @@ protected function addToolbar()
}
if (!$this->isEmptyState && ($canDo->get('core.edit.state') || \count($this->transitions))) {
- $dropdown = $toolbar->dropdownButton('status-group')
- ->text('JTOOLBAR_CHANGE_STATUS')
+ /** @var DropdownButton $dropdown */
+ $dropdown = $toolbar->dropdownButton('status-group', 'JTOOLBAR_CHANGE_STATUS')
->toggleSplit(false)
->icon('icon-ellipsis-h')
->buttonClass('btn btn-action')
@@ -158,8 +157,7 @@ protected function addToolbar()
$childBar = $dropdown->getChildToolbar();
if (\count($this->transitions)) {
- $childBar->separatorButton('transition-headline')
- ->text('COM_CONTENT_RUN_TRANSITIONS')
+ $childBar->separatorButton('transition-headline', 'COM_CONTENT_RUN_TRANSITIONS')
->buttonClass('text-center py-2 h3');
$cmd = "Joomla.submitbutton('articles.runTransition');";
@@ -168,8 +166,7 @@ protected function addToolbar()
$cmd = 'if (document.adminForm.boxchecked.value == 0) { ' . $alert . ' } else { ' . $cmd . ' }';
foreach ($this->transitions as $transition) {
- $childBar->standardButton('transition')
- ->text($transition['text'])
+ $childBar->standardButton('transition', $transition['text'])
->buttonClass('transition-' . (int) $transition['value'])
->icon('icon-project-diagram')
->onclick('document.adminForm.transition_id.value=' . (int) $transition['value'] . ';' . $cmd);
@@ -183,14 +180,12 @@ protected function addToolbar()
$childBar->unpublish('articles.unpublish')->listCheck(true);
- $childBar->standardButton('unfeatured')
- ->text('JUNFEATURE')
+ $childBar->standardButton('unfeatured', 'JUNFEATURE')
->task('articles.unfeatured')
->listCheck(true);
$childBar->archive('articles.archive')->listCheck(true);
-
- $childBar->checkin('articles.checkin')->listCheck(true);
+ $childBar->checkin('articles.checkin');
if (!$this->state->get('filter.published') == ContentComponent::CONDITION_TRASHED) {
$childBar->trash('articles.trash')->listCheck(true);
@@ -199,8 +194,7 @@ protected function addToolbar()
}
if (!$this->isEmptyState && $this->state->get('filter.published') == ContentComponent::CONDITION_TRASHED && $canDo->get('core.delete')) {
- $toolbar->delete('articles.delete')
- ->text('JTOOLBAR_EMPTY_TRASH')
+ $toolbar->delete('articles.delete', 'JTOOLBAR_EMPTY_TRASH')
->message('JGLOBAL_CONFIRM_DELETE')
->listCheck(true);
}
@@ -209,6 +203,6 @@ protected function addToolbar()
$toolbar->preferences('com_content');
}
- ToolbarHelper::help('Articles:_Featured');
+ $toolbar->help('Articles:_Featured');
}
}
diff --git a/administrator/components/com_contenthistory/src/View/History/HtmlView.php b/administrator/components/com_contenthistory/src/View/History/HtmlView.php
index b0ebf8ad27fd4..272cbfaa04785 100644
--- a/administrator/components/com_contenthistory/src/View/History/HtmlView.php
+++ b/administrator/components/com_contenthistory/src/View/History/HtmlView.php
@@ -52,6 +52,13 @@ class HtmlView extends BaseHtmlView
*/
protected $state;
+ /**
+ * The toolbar for the history modal. Note this is rendered inside the modal rather than using the regular module
+ *
+ * @var Toolbar
+ */
+ protected $toolbar;
+
/**
* Method to display the view.
*
@@ -111,37 +118,30 @@ protected function addToolbar(): Toolbar
$previewUrl = Route::_('index.php?option=com_contenthistory&view=preview&layout=preview&tmpl=component&' . $token . '=1');
$compareUrl = Route::_('index.php?option=com_contenthistory&view=compare&layout=compare&tmpl=component&' . $token . '=1');
- $toolbar->basicButton('load')
+ $toolbar->basicButton('load', 'COM_CONTENTHISTORY_BUTTON_LOAD')
->attributes(['data-url' => $loadUrl])
->icon('icon-upload')
->buttonClass('btn btn-success')
- ->text('COM_CONTENTHISTORY_BUTTON_LOAD')
->listCheck(true);
- $toolbar->basicButton('preview')
+ $toolbar->basicButton('preview', 'COM_CONTENTHISTORY_BUTTON_PREVIEW')
->attributes(['data-url' => $previewUrl])
->icon('icon-search')
- ->text('COM_CONTENTHISTORY_BUTTON_PREVIEW')
->listCheck(true);
- $toolbar->basicButton('compare')
+ $toolbar->basicButton('compare', 'COM_CONTENTHISTORY_BUTTON_COMPARE')
->attributes(['data-url' => $compareUrl])
->icon('icon-search-plus')
- ->text('COM_CONTENTHISTORY_BUTTON_COMPARE')
->listCheck(true);
- $toolbar->basicButton('keep')
- ->task('history.keep')
+ $toolbar->basicButton('keep', 'COM_CONTENTHISTORY_BUTTON_KEEP', 'history.keep')
->buttonClass('btn btn-inverse')
->icon('icon-lock')
- ->text('COM_CONTENTHISTORY_BUTTON_KEEP')
->listCheck(true);
- $toolbar->basicButton('delete')
- ->task('history.delete')
+ $toolbar->basicButton('delete', 'COM_CONTENTHISTORY_BUTTON_DELETE', 'history.delete')
->buttonClass('btn btn-danger')
->icon('icon-times')
- ->text('COM_CONTENTHISTORY_BUTTON_DELETE')
->listCheck(true);
return $toolbar;
diff --git a/administrator/components/com_cpanel/src/View/Cpanel/HtmlView.php b/administrator/components/com_cpanel/src/View/Cpanel/HtmlView.php
index 597020015a9cb..0ececde72ff50 100644
--- a/administrator/components/com_cpanel/src/View/Cpanel/HtmlView.php
+++ b/administrator/components/com_cpanel/src/View/Cpanel/HtmlView.php
@@ -15,6 +15,7 @@
use Joomla\CMS\Helper\ModuleHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
+use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
// phpcs:disable PSR1.Files.SideEffects
@@ -58,8 +59,9 @@ class HtmlView extends BaseHtmlView
*/
public function display($tpl = null)
{
- $app = Factory::getApplication();
+ $app = Factory::getApplication();
$dashboard = $app->getInput()->getCmd('dashboard', '');
+ $toolbar = Toolbar::getInstance();
$position = OutputFilter::stringURLSafe($dashboard);
@@ -144,7 +146,7 @@ public function display($tpl = null)
// Set toolbar items for the page
ToolbarHelper::title($title, $icon . ' cpanel');
- ToolbarHelper::help('screen.cpanel');
+ $toolbar->help('screen.cpanel');
// Display the cpanel modules
$this->position = $position ? 'cpanel-' . $position : 'cpanel';
diff --git a/administrator/components/com_fields/src/View/Field/HtmlView.php b/administrator/components/com_fields/src/View/Field/HtmlView.php
index 6f900178b582f..818d46b180ac9 100644
--- a/administrator/components/com_fields/src/View/Field/HtmlView.php
+++ b/administrator/components/com_fields/src/View/Field/HtmlView.php
@@ -17,6 +17,7 @@
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Object\CMSObject;
+use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
// phpcs:disable PSR1.Files.SideEffects
@@ -95,6 +96,7 @@ protected function addToolbar()
$section = $this->state->get('field.section');
$userId = $this->getCurrentUser()->get('id');
$canDo = $this->canDo;
+ $toolbar = Toolbar::getInstance();
$isNew = ($this->item->id == 0);
$checkedOut = !(is_null($this->item->checked_out) || $this->item->checked_out == $userId);
@@ -120,48 +122,46 @@ protected function addToolbar()
// For new records, check the create permission.
if ($isNew) {
- ToolbarHelper::apply('field.apply');
-
- ToolbarHelper::saveGroup(
- [
- ['save', 'field.save'],
- ['save2new', 'field.save2new']
- ],
- 'btn-success'
+ $toolbar->apply('field.apply');
+ $saveGroup = $toolbar->dropdownButton('save-group');
+ $saveGroup->configure(
+ function (Toolbar $childBar) {
+ $childBar->save('field.save');
+ $childBar->save2new('field.save2new');
+ }
);
-
- ToolbarHelper::cancel('field.cancel');
+ $toolbar->cancel('field.cancel');
} else {
// Since it's an existing record, check the edit permission, or fall back to edit own if the owner.
$itemEditable = $canDo->get('core.edit') || ($canDo->get('core.edit.own') && $this->item->created_by == $userId);
- $toolbarButtons = [];
-
// Can't save the record if it's checked out and editable
if (!$checkedOut && $itemEditable) {
- ToolbarHelper::apply('field.apply');
-
- $toolbarButtons[] = ['save', 'field.save'];
-
- // We can save this record, but check the create permission to see if we can return to make a new one.
- if ($canDo->get('core.create')) {
- $toolbarButtons[] = ['save2new', 'field.save2new'];
- }
- }
-
- // If an existing item, can save to a copy.
- if ($canDo->get('core.create')) {
- $toolbarButtons[] = ['save2copy', 'field.save2copy'];
+ $toolbar->apply('field.apply');
}
- ToolbarHelper::saveGroup(
- $toolbarButtons,
- 'btn-success'
+ $saveGroup = $toolbar->dropdownButton('save-group');
+ $saveGroup->configure(
+ function (Toolbar $childBar) use ($checkedOut, $itemEditable, $canDo) {
+ if (!$checkedOut && $itemEditable) {
+ $childBar->save('field.save');
+
+ // We can save this record, but check the create permission to see if we can return to make a new one.
+ if ($canDo->get('core.create')) {
+ $childBar->save2new('field.save2new');
+ }
+ }
+
+ // If an existing item, can save to a copy.
+ if ($canDo->get('core.create')) {
+ $childBar->save2copy('field.save2copy');
+ }
+ }
);
- ToolbarHelper::cancel('field.cancel', 'JTOOLBAR_CLOSE');
+ $toolbar->cancel('field.cancel');
}
- ToolbarHelper::help('Component:_New_or_Edit_Field');
+ $toolbar->help('Component:_New_or_Edit_Field');
}
}
diff --git a/administrator/components/com_fields/src/View/Fields/HtmlView.php b/administrator/components/com_fields/src/View/Fields/HtmlView.php
index 02b4f257547ed..bc04f1b39788a 100644
--- a/administrator/components/com_fields/src/View/Fields/HtmlView.php
+++ b/administrator/components/com_fields/src/View/Fields/HtmlView.php
@@ -19,6 +19,7 @@
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Router\Route;
+use Joomla\CMS\Toolbar\Button\DropdownButton;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\Component\Fields\Administrator\Helper\FieldsHelper;
@@ -126,9 +127,7 @@ protected function addToolbar()
$component = $this->state->get('filter.component');
$section = $this->state->get('filter.section');
$canDo = ContentHelper::getActions($component, 'field', $fieldId);
-
- // Get the toolbar object instance
- $toolbar = Toolbar::getInstance('toolbar');
+ $toolbar = Toolbar::getInstance();
// Avoid nonsense situation.
if ($component == 'com_fields') {
@@ -150,8 +149,8 @@ protected function addToolbar()
}
if ($canDo->get('core.edit.state') || $this->getCurrentUser()->authorise('core.admin')) {
- $dropdown = $toolbar->dropdownButton('status-group')
- ->text('JTOOLBAR_CHANGE_STATUS')
+ /** @var DropdownButton $dropdown */
+ $dropdown = $toolbar->dropdownButton('status-group', 'JTOOLBAR_CHANGE_STATUS')
->toggleSplit(false)
->icon('icon-ellipsis-h')
->buttonClass('btn btn-action')
@@ -161,9 +160,7 @@ protected function addToolbar()
if ($canDo->get('core.edit.state')) {
$childBar->publish('fields.publish')->listCheck(true);
-
$childBar->unpublish('fields.unpublish')->listCheck(true);
-
$childBar->archive('fields.archive')->listCheck(true);
}
@@ -177,16 +174,14 @@ protected function addToolbar()
// Add a batch button
if ($canDo->get('core.create') && $canDo->get('core.edit') && $canDo->get('core.edit.state')) {
- $childBar->popupButton('batch')
- ->text('JTOOLBAR_BATCH')
+ $childBar->popupButton('batch', 'JTOOLBAR_BATCH')
->selector('collapseModal')
->listCheck(true);
}
}
if ($this->state->get('filter.state') == -2 && $canDo->get('core.delete', $component)) {
- $toolbar->delete('fields.delete')
- ->text('JTOOLBAR_EMPTY_TRASH')
+ $toolbar->delete('fields.delete', 'JTOOLBAR_EMPTY_TRASH')
->message('JGLOBAL_CONFIRM_DELETE')
->listCheck(true);
}
diff --git a/administrator/components/com_fields/src/View/Group/HtmlView.php b/administrator/components/com_fields/src/View/Group/HtmlView.php
index b4f211e66ec3c..c51f2b43b0951 100644
--- a/administrator/components/com_fields/src/View/Group/HtmlView.php
+++ b/administrator/components/com_fields/src/View/Group/HtmlView.php
@@ -17,6 +17,7 @@
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Object\CMSObject;
+use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\Component\Fields\Administrator\Helper\FieldsHelper;
@@ -61,7 +62,6 @@ class HtmlView extends BaseHtmlView
*/
protected $canDo;
-
/**
* Execute and display a template script.
*
@@ -69,8 +69,6 @@ class HtmlView extends BaseHtmlView
*
* @return void
*
- * @see JViewLegacy::loadTemplate()
- *
* @since 3.7.0
*/
public function display($tpl = null)
@@ -93,8 +91,6 @@ public function display($tpl = null)
throw new GenericDataException(implode("\n", $errors), 500);
}
- Factory::getApplication()->getInput()->set('hidemainmenu', true);
-
$this->addToolbar();
parent::display($tpl);
@@ -109,8 +105,11 @@ public function display($tpl = null)
*/
protected function addToolbar()
{
+ Factory::getApplication()->getInput()->set('hidemainmenu', true);
+
$component = '';
$parts = FieldsHelper::extract($this->state->get('filter.context'));
+ $toolbar = Toolbar::getInstance();
if ($parts) {
$component = $parts[0];
@@ -145,48 +144,48 @@ protected function addToolbar()
// For new records, check the create permission.
if ($isNew) {
- ToolbarHelper::apply('group.apply');
-
- ToolbarHelper::saveGroup(
- [
- ['save', 'group.save'],
- ['save2new', 'group.save2new']
- ],
- 'btn-success'
+ $toolbar->apply('group.apply');
+ $saveGroup = $toolbar->dropdownButton('save-group');
+
+ $saveGroup->configure(
+ function (Toolbar $childBar) {
+ $childBar->save('group.save');
+ $childBar->save2new('group.save2new');
+ }
);
- ToolbarHelper::cancel('group.cancel');
+ $toolbar->cancel('group.cancel');
} else {
// Since it's an existing record, check the edit permission, or fall back to edit own if the owner.
$itemEditable = $canDo->get('core.edit') || ($canDo->get('core.edit.own') && $this->item->created_by == $userId);
- $toolbarButtons = [];
-
// Can't save the record if it's checked out and editable
if (!$checkedOut && $itemEditable) {
- ToolbarHelper::apply('group.apply');
-
- $toolbarButtons[] = ['save', 'group.save'];
-
- // We can save this record, but check the create permission to see if we can return to make a new one.
- if ($canDo->get('core.create')) {
- $toolbarButtons[] = ['save2new', 'group.save2new'];
- }
+ $toolbar->apply('group.apply');
}
- // If an existing item, can save to a copy.
- if ($canDo->get('core.create')) {
- $toolbarButtons[] = ['save2copy', 'group.save2copy'];
- }
-
- ToolbarHelper::saveGroup(
- $toolbarButtons,
- 'btn-success'
+ $saveGroup = $toolbar->dropdownButton('save-group');
+ $saveGroup->configure(
+ function (Toolbar $childBar) use ($checkedOut, $itemEditable, $canDo) {
+ if (!$checkedOut && $itemEditable) {
+ $childBar->save('group.save');
+
+ // We can save this record, but check the create permission to see if we can return to make a new one.
+ if ($canDo->get('core.create')) {
+ $childBar->save2new('group.save2new');
+ }
+ }
+
+ // If an existing item, can save to a copy.
+ if ($canDo->get('core.create')) {
+ $childBar->save2copy('group.save2copy');
+ }
+ }
);
- ToolbarHelper::cancel('group.cancel', 'JTOOLBAR_CLOSE');
+ $toolbar->cancel('group.cancel');
}
- ToolbarHelper::help('Component:_New_or_Edit_Field_Group');
+ $toolbar->help('Component:_New_or_Edit_Field_Group');
}
}
diff --git a/administrator/components/com_fields/src/View/Groups/HtmlView.php b/administrator/components/com_fields/src/View/Groups/HtmlView.php
index 4b36150b5f968..8094175b3564a 100644
--- a/administrator/components/com_fields/src/View/Groups/HtmlView.php
+++ b/administrator/components/com_fields/src/View/Groups/HtmlView.php
@@ -19,6 +19,7 @@
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Router\Route;
+use Joomla\CMS\Toolbar\Button\DropdownButton;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\Component\Fields\Administrator\Helper\FieldsHelper;
@@ -119,6 +120,7 @@ public function display($tpl = null)
*/
protected function addToolbar()
{
+ $toolbar = Toolbar::getInstance();
$groupId = $this->state->get('filter.group_id');
$component = '';
$parts = FieldsHelper::extract($this->state->get('filter.context'));
@@ -129,9 +131,6 @@ protected function addToolbar()
$canDo = ContentHelper::getActions($component, 'fieldgroup', $groupId);
- // Get the toolbar object instance
- $toolbar = Toolbar::getInstance('toolbar');
-
// Avoid nonsense situation.
if ($component == 'com_fields') {
return;
@@ -152,8 +151,8 @@ protected function addToolbar()
}
if ($canDo->get('core.edit.state') || $this->getCurrentUser()->authorise('core.admin')) {
- $dropdown = $toolbar->dropdownButton('status-group')
- ->text('JTOOLBAR_CHANGE_STATUS')
+ /** @var DropdownButton $dropdown */
+ $dropdown = $toolbar->dropdownButton('status-group', 'JTOOLBAR_CHANGE_STATUS')
->toggleSplit(false)
->icon('icon-ellipsis-h')
->buttonClass('btn btn-action')
@@ -163,9 +162,7 @@ protected function addToolbar()
if ($canDo->get('core.edit.state')) {
$childBar->publish('groups.publish')->listCheck(true);
-
$childBar->unpublish('groups.unpublish')->listCheck(true);
-
$childBar->archive('groups.archive')->listCheck(true);
}
@@ -179,16 +176,14 @@ protected function addToolbar()
// Add a batch button
if ($canDo->get('core.create') && $canDo->get('core.edit') && $canDo->get('core.edit.state')) {
- $childBar->popupButton('batch')
- ->text('JTOOLBAR_BATCH')
+ $childBar->popupButton('batch', 'JTOOLBAR_BATCH')
->selector('collapseModal')
->listCheck(true);
}
}
if ($this->state->get('filter.state') == -2 && $canDo->get('core.delete', $component)) {
- $toolbar->delete('groups.delete')
- ->text('JTOOLBAR_EMPTY_TRASH')
+ $toolbar->delete('groups.delete', 'JTOOLBAR_EMPTY_TRASH')
->message('JGLOBAL_CONFIRM_DELETE')
->listCheck(true);
}
diff --git a/administrator/components/com_finder/src/View/Filter/HtmlView.php b/administrator/components/com_finder/src/View/Filter/HtmlView.php
index a285bfa09d8b0..16bf31598d090 100644
--- a/administrator/components/com_finder/src/View/Filter/HtmlView.php
+++ b/administrator/components/com_finder/src/View/Filter/HtmlView.php
@@ -16,6 +16,7 @@
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Object\CMSObject;
+use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
// phpcs:disable PSR1.Files.SideEffects
@@ -117,6 +118,7 @@ protected function addToolbar()
$isNew = ($this->item->filter_id == 0);
$checkedOut = !(is_null($this->item->checked_out) || $this->item->checked_out == $this->getCurrentUser()->id);
$canDo = ContentHelper::getActions('com_finder');
+ $toolbar = Toolbar::getInstance();
// Configure the toolbar.
ToolbarHelper::title(
@@ -128,48 +130,49 @@ protected function addToolbar()
if ($isNew) {
// For new records, check the create permission.
if ($canDo->get('core.create')) {
- ToolbarHelper::apply('filter.apply');
-
- ToolbarHelper::saveGroup(
- [
- ['save', 'filter.save'],
- ['save2new', 'filter.save2new']
- ],
- 'btn-success'
+ $toolbar->apply('filter.apply');
+ $saveGroup = $toolbar->dropdownButton('save-group');
+ $saveGroup->configure(
+ function (Toolbar $childBar) {
+ $childBar->save('filter.save');
+ $childBar->save2new('filter.save2new');
+ }
);
}
- ToolbarHelper::cancel('filter.cancel');
+ $toolbar->cancel('filter.cancel');
} else {
- $toolbarButtons = [];
-
// Can't save the record if it's checked out.
// Since it's an existing record, check the edit permission.
if (!$checkedOut && $canDo->get('core.edit')) {
- ToolbarHelper::apply('filter.apply');
-
- $toolbarButtons[] = ['save', 'filter.save'];
-
- // We can save this record, but check the create permission to see if we can return to make a new one.
- if ($canDo->get('core.create')) {
- $toolbarButtons[] = ['save2new', 'filter.save2new'];
- }
+ $toolbar->apply('filter.apply');
}
- // If an existing item, can save as a copy
- if ($canDo->get('core.create')) {
- $toolbarButtons[] = ['save2copy', 'filter.save2copy'];
- }
-
- ToolbarHelper::saveGroup(
- $toolbarButtons,
- 'btn-success'
+ $saveGroup = $toolbar->dropdownButton('save-group');
+ $saveGroup->configure(
+ function (Toolbar $childBar) use ($checkedOut, $canDo) {
+ // Can't save the record if it's checked out.
+ // Since it's an existing record, check the edit permission.
+ if (!$checkedOut && $canDo->get('core.edit')) {
+ $childBar->save('filter.save');
+
+ // We can save this record, but check the create permission to see if we can return to make a new one.
+ if ($canDo->get('core.create')) {
+ $childBar->save2new('filter.save2new');
+ }
+ }
+
+ // If an existing item, can save as a copy
+ if ($canDo->get('core.create')) {
+ $childBar->save2copy('filter.save2copy');
+ }
+ }
);
- ToolbarHelper::cancel('filter.cancel', 'JTOOLBAR_CLOSE');
+ $toolbar->cancel('filter.cancel');
}
- ToolbarHelper::divider();
- ToolbarHelper::help('Smart_Search:_New_or_Edit_Filter');
+ $toolbar->divider();
+ $toolbar->help('Smart_Search:_New_or_Edit_Filter');
}
}
diff --git a/administrator/components/com_finder/src/View/Filters/HtmlView.php b/administrator/components/com_finder/src/View/Filters/HtmlView.php
index 7e4cfd3a5156e..e8620ed45ffad 100644
--- a/administrator/components/com_finder/src/View/Filters/HtmlView.php
+++ b/administrator/components/com_finder/src/View/Filters/HtmlView.php
@@ -14,6 +14,7 @@
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
+use Joomla\CMS\Toolbar\Button\DropdownButton;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
@@ -132,20 +133,20 @@ public function display($tpl = null)
*/
protected function addToolbar()
{
- $canDo = ContentHelper::getActions('com_finder');
+ $canDo = ContentHelper::getActions('com_finder');
+ $toolbar = Toolbar::getInstance();
ToolbarHelper::title(Text::_('COM_FINDER_FILTERS_TOOLBAR_TITLE'), 'search-plus finder');
- $toolbar = Toolbar::getInstance('toolbar');
if ($canDo->get('core.create')) {
- ToolbarHelper::addNew('filter.add');
- ToolbarHelper::divider();
+ $toolbar->addNew('filter.add');
+ $toolbar->divider();
}
if ($this->isEmptyState === false) {
if ($canDo->get('core.edit.state')) {
- $dropdown = $toolbar->dropdownButton('status-group')
- ->text('JTOOLBAR_CHANGE_STATUS')
+ /** @var DropdownButton $dropdown */
+ $dropdown = $toolbar->dropdownButton('status-group', 'JTOOLBAR_CHANGE_STATUS')
->toggleSplit(false)
->icon('icon-ellipsis-h')
->buttonClass('btn btn-action')
@@ -159,19 +160,25 @@ protected function addToolbar()
}
if ($canDo->get('core.delete')) {
- ToolbarHelper::deleteList('', 'filters.delete');
- ToolbarHelper::divider();
+ $toolbar->standardButton('delete', 'JTOOLBAR_DELETE', 'filters.delete')
+ ->listCheck(true);
+ $toolbar->divider();
}
- ToolbarHelper::divider();
- $toolbar->appendButton('Popup', 'bars', 'COM_FINDER_STATISTICS', 'index.php?option=com_finder&view=statistics&tmpl=component', 550, 350, '', '', '', Text::_('COM_FINDER_STATISTICS_TITLE'));
- ToolbarHelper::divider();
+ $toolbar->divider();
+ $toolbar->popupButton('bars', 'COM_FINDER_STATISTICS')
+ ->url('index.php?option=com_finder&view=statistics&tmpl=component')
+ ->iframeWidth(550)
+ ->iframeHeight(350)
+ ->title(Text::_('COM_FINDER_STATISTICS_TITLE'))
+ ->icon('icon-bars');
+ $toolbar->divider();
}
if ($canDo->get('core.admin') || $canDo->get('core.options')) {
- ToolbarHelper::preferences('com_finder');
+ $toolbar->preferences('com_finder');
}
- ToolbarHelper::help('Smart_Search:_Search_Filters');
+ $toolbar->help('Smart_Search:_Search_Filters');
}
}
diff --git a/administrator/components/com_finder/src/View/Index/HtmlView.php b/administrator/components/com_finder/src/View/Index/HtmlView.php
index b89769b78d275..5788f36080df1 100644
--- a/administrator/components/com_finder/src/View/Index/HtmlView.php
+++ b/administrator/components/com_finder/src/View/Index/HtmlView.php
@@ -16,6 +16,7 @@
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Plugin\PluginHelper;
+use Joomla\CMS\Toolbar\Button\DropdownButton;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\Component\Finder\Administrator\Helper\FinderHelper;
@@ -168,25 +169,18 @@ public function display($tpl = null)
*/
protected function addToolbar()
{
- $canDo = ContentHelper::getActions('com_finder');
-
- // Get the toolbar object instance
- $toolbar = Toolbar::getInstance('toolbar');
+ $canDo = ContentHelper::getActions('com_finder');
+ $toolbar = Toolbar::getInstance();
ToolbarHelper::title(Text::_('COM_FINDER_INDEX_TOOLBAR_TITLE'), 'search-plus finder');
- $toolbar->appendButton(
- 'Popup',
- 'archive',
- 'COM_FINDER_INDEX',
- 'index.php?option=com_finder&view=indexer&tmpl=component',
- 500,
- 210,
- 0,
- 0,
- 'window.parent.location.reload()',
- Text::_('COM_FINDER_HEADING_INDEXER')
- );
+ $toolbar->popupButton('archive', 'COM_FINDER_INDEX')
+ ->url('index.php?option=com_finder&view=indexer&tmpl=component')
+ ->iframeWidth(550)
+ ->iframeHeight(210)
+ ->onclose('window.parent.location.reload()')
+ ->icon('icon-archive')
+ ->title(Text::_('COM_FINDER_HEADING_INDEXER'));
if (!$this->isEmptyState) {
if ($canDo->get('core.edit.state')) {
@@ -205,15 +199,15 @@ protected function addToolbar()
if ($canDo->get('core.delete')) {
$toolbar->confirmButton('', 'JTOOLBAR_DELETE', 'index.delete')
- ->icon('icon-delete')
->message('COM_FINDER_INDEX_CONFIRM_DELETE_PROMPT')
+ ->icon('icon-delete')
->listCheck(true);
$toolbar->divider();
}
if ($canDo->get('core.edit.state')) {
- $dropdown = $toolbar->dropdownButton('maintenance-group');
- $dropdown->text('COM_FINDER_INDEX_TOOLBAR_MAINTENANCE')
+ /** @var DropdownButton $dropdown */
+ $dropdown = $toolbar->dropdownButton('maintenance-group', 'COM_FINDER_INDEX_TOOLBAR_MAINTENANCE')
->toggleSplit(false)
->icon('icon-wrench')
->buttonClass('btn btn-action');
@@ -222,17 +216,22 @@ protected function addToolbar()
$childBar->standardButton('cog', 'COM_FINDER_INDEX_TOOLBAR_OPTIMISE', 'index.optimise', false);
$childBar->confirmButton('index.purge', 'COM_FINDER_INDEX_TOOLBAR_PURGE', 'index.purge')
- ->icon('icon-trash')
- ->message('COM_FINDER_INDEX_CONFIRM_PURGE_PROMPT');
+ ->message('COM_FINDER_INDEX_CONFIRM_PURGE_PROMPT')
+ ->icon('icon-trash');
}
- $toolbar->appendButton('Popup', 'bars', 'COM_FINDER_STATISTICS', 'index.php?option=com_finder&view=statistics&tmpl=component', 550, 350, '', '', '', Text::_('COM_FINDER_STATISTICS_TITLE'));
+ $toolbar->popupButton('bars', 'COM_FINDER_STATISTICS')
+ ->url('index.php?option=com_finder&view=statistics&tmpl=component')
+ ->iframeWidth(550)
+ ->iframeHeight(350)
+ ->title(Text::_('COM_FINDER_STATISTICS_TITLE'))
+ ->icon('icon-bars');
}
if ($canDo->get('core.admin') || $canDo->get('core.options')) {
- ToolbarHelper::preferences('com_finder');
+ $toolbar->preferences('com_finder');
}
- ToolbarHelper::help('Smart_Search:_Indexed_Content');
+ $toolbar->help('Smart_Search:_Indexed_Content');
}
}
diff --git a/administrator/components/com_finder/src/View/Maps/HtmlView.php b/administrator/components/com_finder/src/View/Maps/HtmlView.php
index bac74fac13035..70ff993dcfc84 100644
--- a/administrator/components/com_finder/src/View/Maps/HtmlView.php
+++ b/administrator/components/com_finder/src/View/Maps/HtmlView.php
@@ -14,6 +14,7 @@
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
+use Joomla\CMS\Toolbar\Button\DropdownButton;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\Component\Finder\Administrator\Helper\LanguageHelper;
@@ -136,17 +137,15 @@ public function display($tpl = null)
*/
protected function addToolbar()
{
- $canDo = ContentHelper::getActions('com_finder');
+ $canDo = ContentHelper::getActions('com_finder');
+ $toolbar = Toolbar::getInstance();
ToolbarHelper::title(Text::_('COM_FINDER_MAPS_TOOLBAR_TITLE'), 'search-plus finder');
- // Get the toolbar object instance
- $toolbar = Toolbar::getInstance('toolbar');
-
if (!$this->isEmptyState) {
if ($canDo->get('core.edit.state')) {
- $dropdown = $toolbar->dropdownButton('status-group')
- ->text('JTOOLBAR_CHANGE_STATUS')
+ /** @var DropdownButton $dropdown */
+ $dropdown = $toolbar->dropdownButton('status-group', 'JTOOLBAR_CHANGE_STATUS')
->toggleSplit(false)
->icon('icon-ellipsis-h')
->buttonClass('btn btn-action')
@@ -159,19 +158,25 @@ protected function addToolbar()
}
if ($canDo->get('core.delete')) {
- ToolbarHelper::deleteList('', 'maps.delete');
- ToolbarHelper::divider();
+ $toolbar->standardButton('delete', 'JTOOLBAR_DELETE', 'maps.delete')
+ ->listCheck(true);
+ $toolbar->divider();
}
- ToolbarHelper::divider();
- $toolbar->appendButton('Popup', 'bars', 'COM_FINDER_STATISTICS', 'index.php?option=com_finder&view=statistics&tmpl=component', 550, 350, '', '', '', Text::_('COM_FINDER_STATISTICS_TITLE'));
- ToolbarHelper::divider();
+ $toolbar->divider();
+ $toolbar->popupButton('bars', 'COM_FINDER_STATISTICS')
+ ->url('index.php?option=com_finder&view=statistics&tmpl=component')
+ ->iframeWidth(550)
+ ->iframeHeight(350)
+ ->title(Text::_('COM_FINDER_STATISTICS_TITLE'))
+ ->icon('icon-bars');
+ $toolbar->divider();
}
if ($canDo->get('core.admin') || $canDo->get('core.options')) {
- ToolbarHelper::preferences('com_finder');
+ $toolbar->preferences('com_finder');
}
- ToolbarHelper::help('Smart_Search:_Content_Maps');
+ $toolbar->help('Smart_Search:_Content_Maps');
}
}
diff --git a/administrator/components/com_finder/src/View/Searches/HtmlView.php b/administrator/components/com_finder/src/View/Searches/HtmlView.php
index 5769739189fb1..148704efbc2e2 100644
--- a/administrator/components/com_finder/src/View/Searches/HtmlView.php
+++ b/administrator/components/com_finder/src/View/Searches/HtmlView.php
@@ -17,6 +17,7 @@
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Router\Route;
+use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Uri\Uri;
@@ -143,22 +144,25 @@ public function display($tpl = null)
*/
protected function addToolbar()
{
- $canDo = $this->canDo;
+ $canDo = $this->canDo;
+ $toolbar = Toolbar::getInstance();
ToolbarHelper::title(Text::_('COM_FINDER_MANAGER_SEARCHES'), 'search');
if (!$this->isEmptyState) {
if ($canDo->get('core.edit.state')) {
- ToolbarHelper::custom('searches.reset', 'refresh', '', 'JSEARCH_RESET', false);
+ $toolbar->standardButton('reset', 'JSEARCH_RESET', 'searches.reset')
+ ->icon('icon-refresh')
+ ->listCheck(false);
}
- ToolbarHelper::divider();
+ $toolbar->divider();
}
if ($canDo->get('core.admin') || $canDo->get('core.options')) {
- ToolbarHelper::preferences('com_finder');
+ $toolbar->preferences('com_finder');
}
- ToolbarHelper::help('Smart_Search:_Search_Term_Analysis');
+ $toolbar->help('Smart_Search:_Search_Term_Analysis');
}
}
diff --git a/administrator/components/com_installer/src/View/Database/HtmlView.php b/administrator/components/com_installer/src/View/Database/HtmlView.php
index 5101e1018e28c..2233a4956b0d8 100644
--- a/administrator/components/com_installer/src/View/Database/HtmlView.php
+++ b/administrator/components/com_installer/src/View/Database/HtmlView.php
@@ -14,6 +14,7 @@
use Joomla\CMS\Form\Form;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Pagination\Pagination;
+use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\Component\Installer\Administrator\Model\DatabaseModel;
use Joomla\Component\Installer\Administrator\View\Installer\HtmlView as InstallerViewDefault;
@@ -118,12 +119,15 @@ public function display($tpl = null)
*/
protected function addToolbar()
{
- /*
- * Set toolbar items for the page.
- */
- ToolbarHelper::custom('database.fix', 'refresh', '', 'COM_INSTALLER_TOOLBAR_DATABASE_FIX', true);
- ToolbarHelper::divider();
+ $toolbar = Toolbar::getInstance();
+
+ $toolbar->standardButton('fix', 'COM_INSTALLER_TOOLBAR_DATABASE_FIX', 'database.fix')
+ ->listCheck(true)
+ ->icon('icon-refresh');
+ $toolbar->divider();
+
parent::addToolbar();
- ToolbarHelper::help('Information:_Database');
+
+ $toolbar->help('Information:_Database');
}
}
diff --git a/administrator/components/com_installer/src/View/Discover/HtmlView.php b/administrator/components/com_installer/src/View/Discover/HtmlView.php
index dc41ec35ca1f7..14af48a992650 100644
--- a/administrator/components/com_installer/src/View/Discover/HtmlView.php
+++ b/administrator/components/com_installer/src/View/Discover/HtmlView.php
@@ -11,6 +11,7 @@
namespace Joomla\Component\Installer\Administrator\View\Discover;
use Joomla\CMS\MVC\View\GenericDataException;
+use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\Component\Installer\Administrator\View\Installer\HtmlView as InstallerViewDefault;
@@ -76,18 +77,20 @@ public function display($tpl = null)
*/
protected function addToolbar()
{
- /*
- * Set toolbar items for the page.
- */
+ $toolbar = Toolbar::getInstance();
+
if (!$this->isEmptyState) {
- ToolbarHelper::custom('discover.install', 'upload', '', 'JTOOLBAR_INSTALL', true);
+ $toolbar->standardButton('upload', 'JTOOLBAR_INSTALL', 'discover.install')
+ ->listCheck(true)
+ ->icon('icon-upload');
}
- ToolbarHelper::custom('discover.refresh', 'refresh', '', 'COM_INSTALLER_TOOLBAR_DISCOVER', false);
- ToolbarHelper::divider();
+ $toolbar->standardButton('discover', 'COM_INSTALLER_TOOLBAR_DISCOVER', 'discover.refresh')
+ ->icon('icon-refresh');
+ $toolbar->divider();
parent::addToolbar();
- ToolbarHelper::help('Extensions:_Discover');
+ $toolbar->help('Extensions:_Discover');
}
}
diff --git a/administrator/components/com_installer/src/View/Install/HtmlView.php b/administrator/components/com_installer/src/View/Install/HtmlView.php
index 29013969db56d..9513d159f28fe 100644
--- a/administrator/components/com_installer/src/View/Install/HtmlView.php
+++ b/administrator/components/com_installer/src/View/Install/HtmlView.php
@@ -15,6 +15,7 @@
use Joomla\CMS\Helper\ContentHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Plugin\PluginHelper;
+use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\Component\Installer\Administrator\View\Installer\HtmlView as InstallerViewDefault;
@@ -63,13 +64,16 @@ public function display($tpl = null)
*/
protected function addToolbar()
{
+ $toolbar = Toolbar::getInstance();
+
if (ContentHelper::getActions('com_installer')->get('core.manage')) {
- ToolbarHelper::link('index.php?option=com_installer&view=manage', 'COM_INSTALLER_TOOLBAR_MANAGE', 'list');
- ToolbarHelper::divider();
+ $toolbar->linkButton('list', 'COM_INSTALLER_TOOLBAR_MANAGE')
+ ->url('index.php?option=com_installer&view=manage');
+ $toolbar->divider();
}
parent::addToolbar();
- ToolbarHelper::help('Extensions:_Install');
+ $toolbar->help('Extensions:_Install');
}
}
diff --git a/administrator/components/com_installer/src/View/Installer/HtmlView.php b/administrator/components/com_installer/src/View/Installer/HtmlView.php
index fa376a9b84544..6ffc8b7979ea2 100644
--- a/administrator/components/com_installer/src/View/Installer/HtmlView.php
+++ b/administrator/components/com_installer/src/View/Installer/HtmlView.php
@@ -14,6 +14,7 @@
use Joomla\CMS\Helper\ContentHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
+use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
// phpcs:disable PSR1.Files.SideEffects
@@ -99,12 +100,14 @@ public function display($tpl = null)
*/
protected function addToolbar()
{
- $canDo = ContentHelper::getActions('com_installer');
+ $canDo = ContentHelper::getActions('com_installer');
+ $toolbar = Toolbar::getInstance();
+
ToolbarHelper::title(Text::_('COM_INSTALLER_HEADER_' . strtoupper($this->getName())), 'puzzle-piece install');
if ($canDo->get('core.admin') || $canDo->get('core.options')) {
- ToolbarHelper::preferences('com_installer');
- ToolbarHelper::divider();
+ $toolbar->preferences('com_installer');
+ $toolbar->divider();
}
}
}
diff --git a/administrator/components/com_installer/src/View/Languages/HtmlView.php b/administrator/components/com_installer/src/View/Languages/HtmlView.php
index 5713211d0f501..14e044d6bc3c9 100644
--- a/administrator/components/com_installer/src/View/Languages/HtmlView.php
+++ b/administrator/components/com_installer/src/View/Languages/HtmlView.php
@@ -16,6 +16,7 @@
use Joomla\CMS\Language\LanguageHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\GenericDataException;
+use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\Component\Installer\Administrator\View\Installer\HtmlView as InstallerViewDefault;
@@ -75,13 +76,15 @@ public function display($tpl = null)
*/
protected function addToolbar()
{
- $canDo = ContentHelper::getActions('com_installer');
+ $canDo = ContentHelper::getActions('com_installer');
+ $toolbar = Toolbar::getInstance();
+
ToolbarHelper::title(Text::_('COM_INSTALLER_HEADER_' . $this->getName()), 'puzzle-piece install');
if ($canDo->get('core.admin')) {
parent::addToolbar();
- ToolbarHelper::help('Extensions:_Languages');
+ $toolbar->help('Extensions:_Languages');
}
}
}
diff --git a/administrator/components/com_installer/src/View/Manage/HtmlView.php b/administrator/components/com_installer/src/View/Manage/HtmlView.php
index ea096693b9a94..a027b3e3cb5fb 100644
--- a/administrator/components/com_installer/src/View/Manage/HtmlView.php
+++ b/administrator/components/com_installer/src/View/Manage/HtmlView.php
@@ -85,35 +85,31 @@ public function display($tpl = null)
*/
protected function addToolbar()
{
- $toolbar = Toolbar::getInstance('toolbar');
+ $toolbar = Toolbar::getInstance();
$canDo = ContentHelper::getActions('com_installer');
if ($canDo->get('core.edit.state')) {
- $toolbar->publish('manage.publish')
- ->text('JTOOLBAR_ENABLE')
+ $toolbar->publish('manage.publish', 'JTOOLBAR_ENABLE')
->listCheck(true);
- $toolbar->unpublish('manage.unpublish')
- ->text('JTOOLBAR_DISABLE')
+ $toolbar->unpublish('manage.unpublish', 'JTOOLBAR_DISABLE')
->listCheck(true);
$toolbar->divider();
}
- $toolbar->standardButton('refresh')
- ->text('JTOOLBAR_REFRESH_CACHE')
- ->task('manage.refresh')
+ $toolbar->standardButton('refresh', 'JTOOLBAR_REFRESH_CACHE', 'manage.refresh')
->listCheck(true);
$toolbar->divider();
if ($canDo->get('core.delete')) {
- $toolbar->delete('manage.remove')
- ->text('JTOOLBAR_UNINSTALL')
+ $toolbar->delete('manage.remove', 'JTOOLBAR_UNINSTALL')
->message('COM_INSTALLER_CONFIRM_UNINSTALL')
->listCheck(true);
$toolbar->divider();
}
if ($canDo->get('core.manage')) {
- ToolbarHelper::link('index.php?option=com_installer&view=install', 'COM_INSTALLER_TOOLBAR_INSTALL_EXTENSIONS', 'upload');
+ $toolbar->linkButton('upload', 'COM_INSTALLER_TOOLBAR_INSTALL_EXTENSIONS')
+ ->url('index.php?option=com_installer&view=install');
$toolbar->divider();
}
diff --git a/administrator/components/com_installer/src/View/Update/HtmlView.php b/administrator/components/com_installer/src/View/Update/HtmlView.php
index 62bb370507085..74cec3f690e97 100644
--- a/administrator/components/com_installer/src/View/Update/HtmlView.php
+++ b/administrator/components/com_installer/src/View/Update/HtmlView.php
@@ -14,6 +14,7 @@
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Object\CMSObject;
+use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\Component\Installer\Administrator\Helper\InstallerHelper as CmsInstallerHelper;
use Joomla\Component\Installer\Administrator\View\Installer\HtmlView as InstallerViewDefault;
@@ -120,14 +121,21 @@ public function display($tpl = null)
*/
protected function addToolbar()
{
+ $toolbar = Toolbar::getInstance();
+
if (false === $this->isEmptyState) {
- ToolbarHelper::custom('update.update', 'upload', '', 'COM_INSTALLER_TOOLBAR_UPDATE', true);
+ $toolbar->standardButton('upload', 'COM_INSTALLER_TOOLBAR_UPDATE', 'update.update')
+ ->listCheck(true)
+ ->icon('icon-upload');
}
- ToolbarHelper::custom('update.find', 'refresh', '', 'COM_INSTALLER_TOOLBAR_FIND_UPDATES', false);
- ToolbarHelper::divider();
+ $toolbar->standardButton('search', 'COM_INSTALLER_TOOLBAR_UPDATE', 'update.find')
+ ->listCheck(false)
+ ->icon('icon-refresh');
+
+ $toolbar->divider();
parent::addToolbar();
- ToolbarHelper::help('Extensions:_Update');
+ $toolbar->help('Extensions:_Update');
}
}
diff --git a/administrator/components/com_installer/src/View/Updatesite/HtmlView.php b/administrator/components/com_installer/src/View/Updatesite/HtmlView.php
index 8f8ce48363cf3..c82c74cf70aad 100644
--- a/administrator/components/com_installer/src/View/Updatesite/HtmlView.php
+++ b/administrator/components/com_installer/src/View/Updatesite/HtmlView.php
@@ -15,6 +15,7 @@
use Joomla\CMS\Helper\ContentHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\GenericDataException;
+use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\Component\Installer\Administrator\Helper\InstallerHelper;
use Joomla\Component\Installer\Administrator\Model\UpdatesiteModel;
@@ -94,7 +95,8 @@ public function display($tpl = null): void
*/
protected function addToolbar(): void
{
- $app = Factory::getApplication();
+ $toolbar = Toolbar::getInstance();
+ $app = Factory::getApplication();
$app->getInput()->set('hidemainmenu', true);
$user = $app->getIdentity();
@@ -108,18 +110,20 @@ protected function addToolbar(): void
// Since it's an existing record, check the edit permission, or fall back to edit own if the owner.
$itemEditable = $canDo->get('core.edit');
- $toolbarButtons = [];
// Can't save the record if it's checked out and editable
if (!$checkedOut && $itemEditable && $this->form->getField('extra_query')) {
- $toolbarButtons[] = ['apply', 'updatesite.apply'];
- $toolbarButtons[] = ['save', 'updatesite.save'];
+ $saveGroup = $toolbar->dropdownButton('save-group');
+
+ $saveGroup->configure(
+ function (Toolbar $childBar) {
+ $childBar->apply('updatesite.apply');
+ $childBar->save('updatesite.save');
+ }
+ );
}
- ToolbarHelper::saveGroup($toolbarButtons);
-
- ToolbarHelper::cancel('updatesite.cancel', 'JTOOLBAR_CLOSE');
-
- ToolbarHelper::help('Edit_Update_Site');
+ $toolbar->cancel('updatesite.cancel');
+ $toolbar->help('Edit_Update_Site');
}
}
diff --git a/administrator/components/com_installer/src/View/Updatesites/HtmlView.php b/administrator/components/com_installer/src/View/Updatesites/HtmlView.php
index 11318dbeae5da..971dd88ad6821 100644
--- a/administrator/components/com_installer/src/View/Updatesites/HtmlView.php
+++ b/administrator/components/com_installer/src/View/Updatesites/HtmlView.php
@@ -14,6 +14,7 @@
use Joomla\CMS\Helper\ContentHelper;
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\Pagination\Pagination;
+use Joomla\CMS\Toolbar\Button\DropdownButton;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\Component\Installer\Administrator\Model\UpdatesitesModel;
@@ -106,8 +107,8 @@ protected function addToolbar(): void
$toolbar = Toolbar::getInstance('toolbar');
if ($canDo->get('core.edit.state')) {
- $dropdown = $toolbar->dropdownButton('status-group')
- ->text('JTOOLBAR_CHANGE_STATUS')
+ /** @var DropdownButton $dropdown */
+ $dropdown = $toolbar->dropdownButton('status-group', 'JTOOLBAR_CHANGE_STATUS')
->toggleSplit(false)
->icon('icon-ellipsis-h')
->buttonClass('btn btn-action')
@@ -126,11 +127,13 @@ protected function addToolbar(): void
}
if ($canDo->get('core.admin') || $canDo->get('core.options')) {
- ToolbarHelper::custom('updatesites.rebuild', 'refresh', '', 'JTOOLBAR_REBUILD', false);
+ $toolbar->standardButton('rebuild', 'JTOOLBAR_REBUILD', 'updatesites.rebuild')
+ ->listCheck(false)
+ ->icon('icon-refresh');
}
parent::addToolbar();
- ToolbarHelper::help('Extensions:_Update_Sites');
+ $toolbar->help('Extensions:_Update_Sites');
}
}
diff --git a/administrator/components/com_installer/src/View/Warnings/HtmlView.php b/administrator/components/com_installer/src/View/Warnings/HtmlView.php
index 3fb2f544a5364..4849f5e489b1a 100644
--- a/administrator/components/com_installer/src/View/Warnings/HtmlView.php
+++ b/administrator/components/com_installer/src/View/Warnings/HtmlView.php
@@ -10,6 +10,7 @@
namespace Joomla\Component\Installer\Administrator\View\Warnings;
+use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\Component\Installer\Administrator\View\Installer\HtmlView as InstallerViewDefault;
@@ -53,8 +54,10 @@ public function display($tpl = null)
*/
protected function addToolbar()
{
+ $toolbar = Toolbar::getInstance();
+
parent::addToolbar();
- ToolbarHelper::help('Information:_Warnings');
+ $toolbar->help('Information:_Warnings');
}
}
diff --git a/administrator/components/com_languages/src/View/Installed/HtmlView.php b/administrator/components/com_languages/src/View/Installed/HtmlView.php
index bf642033694f4..074040fcb8e6f 100644
--- a/administrator/components/com_languages/src/View/Installed/HtmlView.php
+++ b/administrator/components/com_languages/src/View/Installed/HtmlView.php
@@ -111,7 +111,8 @@ public function display($tpl = null)
*/
protected function addToolbar()
{
- $canDo = ContentHelper::getActions('com_languages');
+ $canDo = ContentHelper::getActions('com_languages');
+ $toolbar = Toolbar::getInstance();
if ((int) $this->state->get('client_id') === 1) {
ToolbarHelper::title(Text::_('COM_LANGUAGES_VIEW_INSTALLED_ADMIN_TITLE'), 'comments langmanager');
@@ -120,27 +121,27 @@ protected function addToolbar()
}
if ($canDo->get('core.edit.state')) {
- ToolbarHelper::makeDefault('installed.setDefault');
- ToolbarHelper::divider();
+ $toolbar->makeDefault('installed.setDefault');
+ $toolbar->divider();
}
if ($canDo->get('core.admin')) {
- // Add install languages link to the lang installer component.
- $bar = Toolbar::getInstance('toolbar');
-
// Switch administrator language
if ($this->state->get('client_id', 0) == 1) {
- ToolbarHelper::custom('installed.switchadminlanguage', 'refresh', '', 'COM_LANGUAGES_SWITCH_ADMIN', true);
- ToolbarHelper::divider();
+ $toolbar->standardButton('switch', 'COM_LANGUAGES_SWITCH_ADMIN', 'installed.switchadminlanguage')
+ ->icon('icon-refresh')
+ ->listCheck(true);
+ $toolbar->divider();
}
- $bar->appendButton('Link', 'upload', 'COM_LANGUAGES_INSTALL', 'index.php?option=com_installer&view=languages');
- ToolbarHelper::divider();
+ $toolbar->link('COM_LANGUAGES_INSTALL', 'index.php?option=com_installer&view=languages')
+ ->icon('icon-upload');
+ $toolbar->divider();
- ToolbarHelper::preferences('com_languages');
- ToolbarHelper::divider();
+ $toolbar->preferences('com_languages');
+ $toolbar->divider();
}
- ToolbarHelper::help('Languages:_Installed');
+ $toolbar->help('Languages:_Installed');
}
}
diff --git a/administrator/components/com_languages/src/View/Language/HtmlView.php b/administrator/components/com_languages/src/View/Language/HtmlView.php
index 27c43c9fa74c7..4acc2e1703926 100644
--- a/administrator/components/com_languages/src/View/Language/HtmlView.php
+++ b/administrator/components/com_languages/src/View/Language/HtmlView.php
@@ -16,6 +16,7 @@
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Object\CMSObject;
+use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
// phpcs:disable PSR1.Files.SideEffects
@@ -92,39 +93,41 @@ public function display($tpl = null)
protected function addToolbar()
{
Factory::getApplication()->getInput()->set('hidemainmenu', 1);
- $isNew = empty($this->item->lang_id);
- $canDo = $this->canDo;
+ $isNew = empty($this->item->lang_id);
+ $canDo = $this->canDo;
+ $toolbar = Toolbar::getInstance();
ToolbarHelper::title(
Text::_($isNew ? 'COM_LANGUAGES_VIEW_LANGUAGE_EDIT_NEW_TITLE' : 'COM_LANGUAGES_VIEW_LANGUAGE_EDIT_EDIT_TITLE'),
'comments-2 langmanager'
);
- $toolbarButtons = [];
-
if (($isNew && $canDo->get('core.create')) || (!$isNew && $canDo->get('core.edit'))) {
- ToolbarHelper::apply('language.apply');
-
- $toolbarButtons[] = ['save', 'language.save'];
+ $toolbar->apply('language.apply');
}
- // If an existing item, can save to a copy only if we have create rights.
- if ($canDo->get('core.create')) {
- $toolbarButtons[] = ['save2new', 'language.save2new'];
- }
+ $saveGroup = $toolbar->dropdownButton('save-group');
+
+ $saveGroup->configure(
+ function (Toolbar $childBar) use ($canDo, $isNew) {
+ if (($isNew && $canDo->get('core.create')) || (!$isNew && $canDo->get('core.edit'))) {
+ $childBar->save('language.save');
+ }
- ToolbarHelper::saveGroup(
- $toolbarButtons,
- 'btn-success'
+ // If an existing item, can save to a copy only if we have create rights.
+ if ($canDo->get('core.create')) {
+ $childBar->save2new('language.save2new');
+ }
+ }
);
if ($isNew) {
- ToolbarHelper::cancel('language.cancel');
+ $toolbar->cancel('language.cancel');
} else {
- ToolbarHelper::cancel('language.cancel', 'JTOOLBAR_CLOSE');
+ $toolbar->cancel('language.cancel');
}
- ToolbarHelper::divider();
- ToolbarHelper::help('Languages:_Edit_Content_Language');
+ $toolbar->divider();
+ $toolbar->help('Languages:_Edit_Content_Language');
}
}
diff --git a/administrator/components/com_languages/src/View/Languages/HtmlView.php b/administrator/components/com_languages/src/View/Languages/HtmlView.php
index 7c79fa9214fbc..de88c053479ee 100644
--- a/administrator/components/com_languages/src/View/Languages/HtmlView.php
+++ b/administrator/components/com_languages/src/View/Languages/HtmlView.php
@@ -14,6 +14,7 @@
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
+use Joomla\CMS\Toolbar\Button\DropdownButton;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
@@ -102,20 +103,18 @@ public function display($tpl = null)
*/
protected function addToolbar(): void
{
- $canDo = ContentHelper::getActions('com_languages');
+ $canDo = ContentHelper::getActions('com_languages');
+ $toolbar = Toolbar::getInstance();
ToolbarHelper::title(Text::_('COM_LANGUAGES_VIEW_LANGUAGES_TITLE'), 'comments langmanager');
- // Get the toolbar object instance
- $toolbar = Toolbar::getInstance('toolbar');
-
if ($canDo->get('core.create')) {
$toolbar->addNew('language.add');
}
if ($canDo->get('core.edit.state')) {
- $dropdown = $toolbar->dropdownButton('status-group')
- ->text('JTOOLBAR_CHANGE_STATUS')
+ /** @var DropdownButton $dropdown */
+ $dropdown = $toolbar->dropdownButton('status-group', 'JTOOLBAR_CHANGE_STATUS')
->toggleSplit(false)
->icon('icon-ellipsis-h')
->buttonClass('btn btn-action')
@@ -132,22 +131,21 @@ protected function addToolbar(): void
}
if ($this->state->get('filter.published') == -2 && $canDo->get('core.delete')) {
- $toolbar->delete('languages.delete')
- ->text('JTOOLBAR_EMPTY_TRASH')
+ $toolbar->delete('languages.delete', 'JTOOLBAR_EMPTY_TRASH')
->message('JGLOBAL_CONFIRM_DELETE')
->listCheck(true);
}
if ($canDo->get('core.admin')) {
// Add install languages link to the lang installer component.
- $bar = Toolbar::getInstance('toolbar');
- $bar->appendButton('Link', 'upload', 'COM_LANGUAGES_INSTALL', 'index.php?option=com_installer&view=languages');
- ToolbarHelper::divider();
+ $toolbar->link('COM_LANGUAGES_INSTALL', 'index.php?option=com_installer&view=languages')
+ ->icon('icon-upload');
+ $toolbar->divider();
- ToolbarHelper::preferences('com_languages');
- ToolbarHelper::divider();
+ $toolbar->preferences('com_languages');
+ $toolbar->divider();
}
- ToolbarHelper::help('Languages:_Content');
+ $toolbar->help('Languages:_Content');
}
}
diff --git a/administrator/components/com_languages/src/View/Override/HtmlView.php b/administrator/components/com_languages/src/View/Override/HtmlView.php
index ea5a4bac86bc7..022cb91f0a0d9 100644
--- a/administrator/components/com_languages/src/View/Override/HtmlView.php
+++ b/administrator/components/com_languages/src/View/Override/HtmlView.php
@@ -15,6 +15,7 @@
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
+use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
// phpcs:disable PSR1.Files.SideEffects
@@ -111,35 +112,37 @@ protected function addToolbar()
{
Factory::getApplication()->getInput()->set('hidemainmenu', true);
- $canDo = ContentHelper::getActions('com_languages');
+ $canDo = ContentHelper::getActions('com_languages');
+ $toolbar = Toolbar::getInstance();
ToolbarHelper::title(Text::_('COM_LANGUAGES_VIEW_OVERRIDE_EDIT_TITLE'), 'comments langmanager');
- $toolbarButtons = [];
-
if ($canDo->get('core.edit')) {
- ToolbarHelper::apply('override.apply');
-
- $toolbarButtons[] = ['save', 'override.save'];
+ $toolbar->apply('override.apply');
}
- // This component does not support Save as Copy.
- if ($canDo->get('core.edit') && $canDo->get('core.create')) {
- $toolbarButtons[] = ['save2new', 'override.save2new'];
- }
+ $saveGroup = $toolbar->dropdownButton('save-group');
+
+ $saveGroup->configure(
+ function (Toolbar $childBar) use ($canDo) {
+ if ($canDo->get('core.edit')) {
+ $childBar->save('override.save');
+ }
- ToolbarHelper::saveGroup(
- $toolbarButtons,
- 'btn-success'
+ // This component does not support Save as Copy.
+ if ($canDo->get('core.edit') && $canDo->get('core.create')) {
+ $childBar->save2new('override.save2new');
+ }
+ }
);
if (empty($this->item->key)) {
- ToolbarHelper::cancel('override.cancel');
+ $toolbar->cancel('override.cancel', 'JTOOLBAR_CANCEL');
} else {
- ToolbarHelper::cancel('override.cancel', 'JTOOLBAR_CLOSE');
+ $toolbar->cancel('override.cancel');
}
- ToolbarHelper::divider();
- ToolbarHelper::help('Languages:_Edit_Override');
+ $toolbar->divider();
+ $toolbar->help('Languages:_Edit_Override');
}
}
diff --git a/administrator/components/com_languages/src/View/Overrides/HtmlView.php b/administrator/components/com_languages/src/View/Overrides/HtmlView.php
index 670230593a974..e27d5a1d3b873 100644
--- a/administrator/components/com_languages/src/View/Overrides/HtmlView.php
+++ b/administrator/components/com_languages/src/View/Overrides/HtmlView.php
@@ -14,6 +14,7 @@
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
+use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
// phpcs:disable PSR1.Files.SideEffects
@@ -97,26 +98,30 @@ protected function addToolbar()
{
// Get the results for each action
$canDo = ContentHelper::getActions('com_languages');
+ $toolbar = Toolbar::getInstance();
ToolbarHelper::title(Text::_('COM_LANGUAGES_VIEW_OVERRIDES_TITLE'), 'comments langmanager');
if ($canDo->get('core.create')) {
- ToolbarHelper::addNew('override.add');
+ $toolbar->addNew('override.add');
}
if ($canDo->get('core.delete') && $this->pagination->total) {
- ToolbarHelper::deleteList('JGLOBAL_CONFIRM_DELETE', 'overrides.delete', 'JTOOLBAR_DELETE');
+ $toolbar->delete('overrides.delete')
+ ->message('JGLOBAL_CONFIRM_DELETE');
}
if ($this->getCurrentUser()->authorise('core.admin')) {
- ToolbarHelper::custom('overrides.purge', 'refresh', '', 'COM_LANGUAGES_VIEW_OVERRIDES_PURGE', false);
+ $toolbar->standardButton('purge', 'COM_LANGUAGES_VIEW_OVERRIDES_PURGE', 'overrides.purge')
+ ->listCheck(false)
+ ->icon('icon-refresh');
}
if ($canDo->get('core.admin')) {
- ToolbarHelper::preferences('com_languages');
+ $toolbar->preferences('com_languages');
}
- ToolbarHelper::divider();
- ToolbarHelper::help('Languages:_Overrides');
+ $toolbar->divider();
+ $toolbar->help('Languages:_Overrides');
}
}
diff --git a/administrator/components/com_media/src/View/File/HtmlView.php b/administrator/components/com_media/src/View/File/HtmlView.php
index 1ede1045fbbab..365ecd88e6ccf 100644
--- a/administrator/components/com_media/src/View/File/HtmlView.php
+++ b/administrator/components/com_media/src/View/File/HtmlView.php
@@ -14,6 +14,7 @@
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
+use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
// phpcs:disable PSR1.Files.SideEffects
@@ -69,10 +70,13 @@ protected function addToolbar()
{
ToolbarHelper::title(Text::_('COM_MEDIA_EDIT'), 'images mediamanager');
- ToolbarHelper::apply('apply');
- ToolbarHelper::save('save');
- ToolbarHelper::custom('reset', 'refresh', '', 'COM_MEDIA_RESET', false);
+ $toolbar = Toolbar::getInstance();
+ $toolbar->apply('apply');
+ $toolbar->save('save');
+ $toolbar->standardButton('reset', 'COM_MEDIA_RESET', 'reset')
+ ->icon('icon-refresh')
+ ->listCheck(false);
- ToolbarHelper::cancel('cancel', 'JTOOLBAR_CLOSE');
+ $toolbar->cancel('cancel');
}
}
diff --git a/administrator/components/com_media/src/View/Media/HtmlView.php b/administrator/components/com_media/src/View/Media/HtmlView.php
index e79a467d50349..3606e4c81e72f 100644
--- a/administrator/components/com_media/src/View/Media/HtmlView.php
+++ b/administrator/components/com_media/src/View/Media/HtmlView.php
@@ -84,11 +84,9 @@ public function display($tpl = null)
*/
protected function prepareToolbar()
{
- $tmpl = Factory::getApplication()->getInput()->getCmd('tmpl');
-
- // Get the toolbar object instance
- $bar = Toolbar::getInstance('toolbar');
- $user = $this->getCurrentUser();
+ $tmpl = Factory::getApplication()->getInput()->getCmd('tmpl');
+ $toolbar = Toolbar::getInstance();
+ $user = $this->getCurrentUser();
// Set the title
ToolbarHelper::title(Text::_('COM_MEDIA'), 'images mediamanager');
@@ -99,14 +97,16 @@ protected function prepareToolbar()
// Add the upload button
$layout = new FileLayout('toolbar.upload', JPATH_COMPONENT_ADMINISTRATOR . '/layouts');
- $bar->appendButton('Custom', $layout->render([]), 'upload');
- ToolbarHelper::divider();
+ $toolbar->customButton('upload')
+ ->html($layout->render([]));
+ $toolbar->divider();
// Add the create folder button
$layout = new FileLayout('toolbar.create-folder', JPATH_COMPONENT_ADMINISTRATOR . '/layouts');
- $bar->appendButton('Custom', $layout->render([]), 'new');
- ToolbarHelper::divider();
+ $toolbar->customButton('new')
+ ->html($layout->render([]));
+ $toolbar->divider();
}
// Add a delete button
@@ -115,20 +115,21 @@ protected function prepareToolbar()
// Instantiate a new FileLayout instance and render the layout
$layout = new FileLayout('toolbar.delete', JPATH_COMPONENT_ADMINISTRATOR . '/layouts');
- $bar->appendButton('Custom', $layout->render([]), 'delete');
- ToolbarHelper::divider();
+ $toolbar->customButton('delete')
+ ->html($layout->render([]));
+ $toolbar->divider();
}
// Add the preferences button
if (($user->authorise('core.admin', 'com_media') || $user->authorise('core.options', 'com_media')) && $tmpl !== 'component')
{
- ToolbarHelper::preferences('com_media');
- ToolbarHelper::divider();
+ $toolbar->preferences('com_media');
+ $toolbar->divider();
}
if ($tmpl !== 'component')
{
- ToolbarHelper::help('Media');
+ $toolbar->help('Media');
}
}
}
diff --git a/administrator/components/com_menus/src/View/Item/HtmlView.php b/administrator/components/com_menus/src/View/Item/HtmlView.php
index 2b9288b430216..7e93030d71776 100644
--- a/administrator/components/com_menus/src/View/Item/HtmlView.php
+++ b/administrator/components/com_menus/src/View/Item/HtmlView.php
@@ -18,6 +18,7 @@
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Object\CMSObject;
+use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
// phpcs:disable PSR1.Files.SideEffects
@@ -133,53 +134,61 @@ protected function addToolbar()
$checkedOut = !(is_null($this->item->checked_out) || $this->item->checked_out == $user->get('id'));
$canDo = $this->canDo;
$clientId = $this->state->get('item.client_id', 0);
+ $toolbar = Toolbar::getInstance();
ToolbarHelper::title(Text::_($isNew ? 'COM_MENUS_VIEW_NEW_ITEM_TITLE' : 'COM_MENUS_VIEW_EDIT_ITEM_TITLE'), 'list menu-add');
- $toolbarButtons = [];
-
// If a new item, can save the item. Allow users with edit permissions to apply changes to prevent returning to grid.
if ($isNew && $canDo->get('core.create')) {
if ($canDo->get('core.edit')) {
- ToolbarHelper::apply('item.apply');
+ $toolbar->apply('item.apply');
}
-
- $toolbarButtons[] = ['save', 'item.save'];
}
// If not checked out, can save the item.
if (!$isNew && !$checkedOut && $canDo->get('core.edit')) {
- ToolbarHelper::apply('item.apply');
-
- $toolbarButtons[] = ['save', 'item.save'];
- }
-
- // If the user can create new items, allow them to see Save & New
- if ($canDo->get('core.create')) {
- $toolbarButtons[] = ['save2new', 'item.save2new'];
- }
-
- // If an existing item, can save to a copy only if we have create rights.
- if (!$isNew && $canDo->get('core.create')) {
- $toolbarButtons[] = ['save2copy', 'item.save2copy'];
+ $toolbar->apply('item.apply');
}
- ToolbarHelper::saveGroup(
- $toolbarButtons,
- 'btn-success'
+ $saveGroup = $toolbar->dropdownButton('save-group');
+
+ $saveGroup->configure(
+ function (Toolbar $childBar) use ($isNew, $checkedOut, $canDo) {
+ // If a new item, can save the item. Allow users with edit permissions to apply changes to prevent returning to grid.
+ if ($isNew && $canDo->get('core.create')) {
+ $childBar->save('item.save');
+ }
+
+ // If not checked out, can save the item.
+ if (!$isNew && !$checkedOut && $canDo->get('core.edit')) {
+ $childBar->save('item.save');
+ }
+
+ // If the user can create new items, allow them to see Save & New
+ if ($canDo->get('core.create')) {
+ $childBar->save2new('item.save2new');
+ }
+
+ // If an existing item, can save to a copy only if we have create rights.
+ if (!$isNew && $canDo->get('core.create')) {
+ $childBar->save2copy('item.save2copy');
+ }
+ }
);
if (!$isNew && Associations::isEnabled() && ComponentHelper::isEnabled('com_associations') && $clientId != 1) {
- ToolbarHelper::custom('item.editAssociations', 'contract', '', 'JTOOLBAR_ASSOCIATIONS', false, false);
+ $toolbar->standardButton('associations', 'JTOOLBAR_ASSOCIATIONS', 'item.editAssociations')
+ ->icon('icon-contract')
+ ->listCheck(false);
}
if ($isNew) {
- ToolbarHelper::cancel('item.cancel');
+ $toolbar->cancel('item.cancel', 'JTOOLBAR_CANCEL');
} else {
- ToolbarHelper::cancel('item.cancel', 'JTOOLBAR_CLOSE');
+ $toolbar->cancel('item.cancel');
}
- ToolbarHelper::divider();
+ $toolbar->divider();
// Get the help information for the menu item.
$lang = Factory::getLanguage();
@@ -194,6 +203,6 @@ protected function addToolbar()
$url = $help->url;
}
- ToolbarHelper::help($help->key, $help->local, $url);
+ $toolbar->help($help->key, $help->local, $url);
}
}
diff --git a/administrator/components/com_menus/src/View/Menu/HtmlView.php b/administrator/components/com_menus/src/View/Menu/HtmlView.php
index 261a24e56ce56..45f61f23a0e90 100644
--- a/administrator/components/com_menus/src/View/Menu/HtmlView.php
+++ b/administrator/components/com_menus/src/View/Menu/HtmlView.php
@@ -16,6 +16,7 @@
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Object\CMSObject;
+use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
// phpcs:disable PSR1.Files.SideEffects
@@ -95,45 +96,50 @@ protected function addToolbar()
$input = Factory::getApplication()->getInput();
$input->set('hidemainmenu', true);
- $isNew = ($this->item->id == 0);
+ $isNew = ($this->item->id == 0);
+ $toolbar = Toolbar::getInstance();
ToolbarHelper::title(Text::_($isNew ? 'COM_MENUS_VIEW_NEW_MENU_TITLE' : 'COM_MENUS_VIEW_EDIT_MENU_TITLE'), 'list menu');
- $toolbarButtons = [];
-
// If a new item, can save the item. Allow users with edit permissions to apply changes to prevent returning to grid.
- if ($isNew && $this->canDo->get('core.create')) {
- if ($this->canDo->get('core.edit')) {
- ToolbarHelper::apply('menu.apply');
- }
-
- $toolbarButtons[] = ['save', 'menu.save'];
+ if ($isNew && $this->canDo->get('core.create') && $this->canDo->get('core.edit')) {
+ $toolbar->apply('menu.apply');
}
// If user can edit, can save the item.
if (!$isNew && $this->canDo->get('core.edit')) {
- ToolbarHelper::apply('menu.apply');
-
- $toolbarButtons[] = ['save', 'menu.save'];
+ $toolbar->apply('menu.apply');
}
- // If the user can create new items, allow them to see Save & New
- if ($this->canDo->get('core.create')) {
- $toolbarButtons[] = ['save2new', 'menu.save2new'];
- }
-
- ToolbarHelper::saveGroup(
- $toolbarButtons,
- 'btn-success'
+ $saveGroup = $toolbar->dropdownButton('save-group');
+ $canDo = $this->canDo;
+
+ $saveGroup->configure(
+ function (Toolbar $childBar) use ($isNew, $canDo) {
+ // If a new item, can save the item. Allow users with edit permissions to apply changes to prevent returning to grid.
+ if ($isNew && $canDo->get('core.create')) {
+ $childBar->save('menu.save');
+ }
+
+ // If user can edit, can save the item.
+ if (!$isNew && $canDo->get('core.edit')) {
+ $childBar->save('menu.save');
+ }
+
+ // If the user can create new items, allow them to see Save & New
+ if ($canDo->get('core.create')) {
+ $childBar->save2new('menu.save2new');
+ }
+ }
);
if ($isNew) {
- ToolbarHelper::cancel('menu.cancel');
+ $toolbar->cancel('menu.cancel', 'JTOOLBAR_CANCEL');
} else {
- ToolbarHelper::cancel('menu.cancel', 'JTOOLBAR_CLOSE');
+ $toolbar->cancel('menu.cancel');
}
- ToolbarHelper::divider();
- ToolbarHelper::help('Menus:_Edit');
+ $toolbar->divider();
+ $toolbar->help('Menus:_Edit');
}
}
diff --git a/administrator/components/com_menus/src/View/Menus/HtmlView.php b/administrator/components/com_menus/src/View/Menus/HtmlView.php
index 949db95dbe5de..571f4068f8ab1 100644
--- a/administrator/components/com_menus/src/View/Menus/HtmlView.php
+++ b/administrator/components/com_menus/src/View/Menus/HtmlView.php
@@ -14,6 +14,7 @@
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
+use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
// phpcs:disable PSR1.Files.SideEffects
@@ -112,29 +113,33 @@ public function display($tpl = null)
*/
protected function addToolbar()
{
- $canDo = ContentHelper::getActions('com_menus');
+ $canDo = ContentHelper::getActions('com_menus');
+ $toolbar = Toolbar::getInstance();
ToolbarHelper::title(Text::_('COM_MENUS_VIEW_MENUS_TITLE'), 'list menumgr');
if ($canDo->get('core.create')) {
- ToolbarHelper::addNew('menu.add');
+ $toolbar->addNew('menu.add');
}
if ($canDo->get('core.delete')) {
- ToolbarHelper::divider();
- ToolbarHelper::deleteList('COM_MENUS_MENU_CONFIRM_DELETE', 'menus.delete', 'JTOOLBAR_DELETE');
+ $toolbar->divider();
+ $toolbar->delete('menus.delete')
+ ->message('COM_MENUS_MENU_CONFIRM_DELETE');
}
if ($canDo->get('core.admin') && $this->state->get('client_id') == 1) {
- ToolbarHelper::custom('menu.exportXml', 'download', '', 'COM_MENUS_MENU_EXPORT_BUTTON', true);
+ $toolbar->standardButton('download', 'COM_MENUS_MENU_EXPORT_BUTTON', 'menu.exportXml')
+ ->icon('icon-download')
+ ->listCheck(true);
}
if ($canDo->get('core.admin') || $canDo->get('core.options')) {
- ToolbarHelper::divider();
- ToolbarHelper::preferences('com_menus');
+ $toolbar->divider();
+ $toolbar->preferences('com_menus');
}
- ToolbarHelper::divider();
- ToolbarHelper::help('Menus');
+ $toolbar->divider();
+ $toolbar->help('Menus');
}
}
diff --git a/administrator/components/com_menus/src/View/Menutypes/HtmlView.php b/administrator/components/com_menus/src/View/Menutypes/HtmlView.php
index f667a146ccb82..7992a364b1de1 100644
--- a/administrator/components/com_menus/src/View/Menutypes/HtmlView.php
+++ b/administrator/components/com_menus/src/View/Menutypes/HtmlView.php
@@ -97,15 +97,15 @@ protected function addToolbar()
// Add page title
ToolbarHelper::title(Text::_('COM_MENUS'), 'list menumgr');
- // Get the toolbar object instance
- $bar = Toolbar::getInstance('toolbar');
+ $toolbar = Toolbar::getInstance();
// Cancel
$title = Text::_('JTOOLBAR_CANCEL');
$dhtml = "
$title";
- $bar->appendButton('Custom', $dhtml, 'new');
+ $toolbar->customButton('new')
+ ->html($dhtml);
}
/**
diff --git a/administrator/components/com_messages/src/View/Config/HtmlView.php b/administrator/components/com_messages/src/View/Config/HtmlView.php
index e048fed02a8b2..cb066f038b506 100644
--- a/administrator/components/com_messages/src/View/Config/HtmlView.php
+++ b/administrator/components/com_messages/src/View/Config/HtmlView.php
@@ -14,6 +14,7 @@
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
+use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
// phpcs:disable PSR1.Files.SideEffects
@@ -89,8 +90,8 @@ protected function addToolbar()
ToolbarHelper::title(Text::_('COM_MESSAGES_TOOLBAR_MY_SETTINGS'), 'envelope');
- ToolbarHelper::apply('config.save', 'JSAVE');
-
- ToolbarHelper::cancel('config.cancel', 'JCANCEL');
+ $toolbar = Toolbar::getInstance();
+ $toolbar->apply('config.save', 'JSAVE');
+ $toolbar->cancel('config.cancel', 'JCANCEL');
}
}
diff --git a/administrator/components/com_messages/src/View/Message/HtmlView.php b/administrator/components/com_messages/src/View/Message/HtmlView.php
index dae8f22ed0318..ea64aae89cba9 100644
--- a/administrator/components/com_messages/src/View/Message/HtmlView.php
+++ b/administrator/components/com_messages/src/View/Message/HtmlView.php
@@ -14,6 +14,7 @@
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
+use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\User\User;
@@ -85,13 +86,16 @@ public function display($tpl = null)
protected function addToolbar()
{
$app = Factory::getApplication();
+ $toolbar = Toolbar::getInstance();
if ($this->getLayout() == 'edit') {
$app->getInput()->set('hidemainmenu', true);
ToolbarHelper::title(Text::_('COM_MESSAGES_WRITE_PRIVATE_MESSAGE'), 'envelope-open-text new-privatemessage');
- ToolbarHelper::custom('message.save', 'envelope', '', 'COM_MESSAGES_TOOLBAR_SEND', false);
- ToolbarHelper::cancel('message.cancel');
- ToolbarHelper::help('Private_Messages:_Write');
+ $toolbar->standardButton('save', 'COM_MESSAGES_TOOLBAR_SEND', 'message.save')
+ ->icon('icon-envelope')
+ ->listCheck(false);
+ $toolbar->cancel('message.cancel');
+ $toolbar->help('Private_Messages:_Write');
} else {
ToolbarHelper::title(Text::_('COM_MESSAGES_VIEW_PRIVATE_MESSAGE'), 'envelope inbox');
$sender = User::getInstance($this->item->user_id_from);
@@ -101,11 +105,13 @@ protected function addToolbar()
|| $sender->authorise('core.manage', 'com_messages') && $sender->authorise('core.login.admin'))
&& $app->getIdentity()->authorise('core.manage', 'com_users')
) {
- ToolbarHelper::custom('message.reply', 'redo', '', 'COM_MESSAGES_TOOLBAR_REPLY', false);
+ $toolbar->standardButton('reply', 'COM_MESSAGES_TOOLBAR_REPLY', 'message.reply')
+ ->icon('icon-redo')
+ ->listCheck(false);
}
- ToolbarHelper::cancel('message.cancel');
- ToolbarHelper::help('Private_Messages:_Read');
+ $toolbar->cancel('message.cancel');
+ $toolbar->help('Private_Messages:_Read');
}
}
}
diff --git a/administrator/components/com_modules/src/View/Module/HtmlView.php b/administrator/components/com_modules/src/View/Module/HtmlView.php
index 1e7752f6d6b8b..2ef40953fe1be 100644
--- a/administrator/components/com_modules/src/View/Module/HtmlView.php
+++ b/administrator/components/com_modules/src/View/Module/HtmlView.php
@@ -15,6 +15,7 @@
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
+use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
// phpcs:disable PSR1.Files.SideEffects
@@ -96,22 +97,24 @@ protected function addToolbar()
$isNew = ($this->item->id == 0);
$checkedOut = !(is_null($this->item->checked_out) || $this->item->checked_out == $user->get('id'));
$canDo = $this->canDo;
+ $toolbar = Toolbar::getInstance();
ToolbarHelper::title(Text::sprintf('COM_MODULES_MANAGER_MODULE', Text::_($this->item->module)), 'cube module');
// For new records, check the create permission.
if ($isNew && $canDo->get('core.create')) {
- ToolbarHelper::apply('module.apply');
-
- ToolbarHelper::saveGroup(
- [
- ['save', 'module.save'],
- ['save2new', 'module.save2new']
- ],
- 'btn-success'
+ $toolbar->apply('module.apply');
+
+ $saveGroup = $toolbar->dropdownButton('save-group');
+
+ $saveGroup->configure(
+ function (Toolbar $childBar) {
+ $childBar->save('module.save');
+ $childBar->save2new('module.save2new');
+ }
);
- ToolbarHelper::cancel('module.cancel');
+ $toolbar->cancel('module.cancel', 'JTOOLBAR_CANCEL');
} else {
$toolbarButtons = [];
@@ -119,7 +122,7 @@ protected function addToolbar()
if (!$checkedOut) {
// Since it's an existing record, check the edit permission.
if ($canDo->get('core.edit')) {
- ToolbarHelper::apply('module.apply');
+ $toolbar->apply('module.apply');
$toolbarButtons[] = ['save', 'module.save'];
@@ -135,12 +138,28 @@ protected function addToolbar()
$toolbarButtons[] = ['save2copy', 'module.save2copy'];
}
- ToolbarHelper::saveGroup(
- $toolbarButtons,
- 'btn-success'
+ $saveGroup = $toolbar->dropdownButton('save-group');
+
+ $saveGroup->configure(
+ function (Toolbar $childBar) use ($checkedOut, $canDo) {
+ // Can't save the record if it's checked out. Since it's an existing record, check the edit permission.
+ if (!$checkedOut && $canDo->get('core.edit')) {
+ $childBar->save('module.save');
+
+ // We can save this record, but check the create permission to see if we can return to make a new one.
+ if ($canDo->get('core.create')) {
+ $childBar->save('module.save2new');
+ }
+ }
+
+ // If checked out, we can still save
+ if ($canDo->get('core.create')) {
+ $childBar->save('module.save2copy');
+ }
+ }
);
- ToolbarHelper::cancel('module.cancel', 'JTOOLBAR_CLOSE');
+ $toolbar->cancel('module.cancel');
}
// Get the help information for the menu item.
@@ -156,7 +175,7 @@ protected function addToolbar()
$url = null;
}
- ToolbarHelper::inlinehelp();
- ToolbarHelper::help($help->key, false, $url);
+ $toolbar->inlinehelp();
+ $toolbar->help($help->key, false, $url);
}
}
diff --git a/administrator/components/com_modules/src/View/Modules/HtmlView.php b/administrator/components/com_modules/src/View/Modules/HtmlView.php
index de28392515e41..d5ba10191b43b 100644
--- a/administrator/components/com_modules/src/View/Modules/HtmlView.php
+++ b/administrator/components/com_modules/src/View/Modules/HtmlView.php
@@ -17,6 +17,7 @@
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
+use Joomla\CMS\Toolbar\Button\DropdownButton;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
@@ -174,7 +175,7 @@ protected function addToolbar()
$user = $this->getCurrentUser();
// Get the toolbar object instance
- $toolbar = Toolbar::getInstance('toolbar');
+ $toolbar = Toolbar::getInstance();
if ($state->get('client_id') == 1) {
ToolbarHelper::title(Text::_('COM_MODULES_MANAGER_MODULES_ADMIN'), 'cube module');
@@ -188,8 +189,8 @@ protected function addToolbar()
}
if (!$this->isEmptyState && ($canDo->get('core.edit.state') || $this->getCurrentUser()->authorise('core.admin'))) {
- $dropdown = $toolbar->dropdownButton('status-group')
- ->text('JTOOLBAR_CHANGE_STATUS')
+ /** @var DropdownButton $dropdown */
+ $dropdown = $toolbar->dropdownButton('status-group', 'JTOOLBAR_CHANGE_STATUS')
->toggleSplit(false)
->icon('icon-ellipsis-h')
->buttonClass('btn btn-action')
@@ -216,23 +217,19 @@ protected function addToolbar()
$user->authorise('core.create', 'com_modules') && $user->authorise('core.edit', 'com_modules')
&& $user->authorise('core.edit.state', 'com_modules')
) {
- $childBar->popupButton('batch')
- ->text('JTOOLBAR_BATCH')
+ $childBar->popupButton('batch', 'JTOOLBAR_BATCH')
->selector('collapseModal')
->listCheck(true);
}
if ($canDo->get('core.create')) {
- $childBar->standardButton('copy')
- ->text('JTOOLBAR_DUPLICATE')
- ->task('modules.duplicate')
+ $childBar->standardButton('copy', 'JTOOLBAR_DUPLICATE', 'modules.duplicate')
->listCheck(true);
}
}
if (!$this->isEmptyState && ($state->get('filter.state') == -2 && $canDo->get('core.delete'))) {
- $toolbar->delete('modules.delete')
- ->text('JTOOLBAR_EMPTY_TRASH')
+ $toolbar->delete('modules.delete', 'JTOOLBAR_EMPTY_TRASH')
->message('JGLOBAL_CONFIRM_DELETE')
->listCheck(true);
}
diff --git a/administrator/components/com_modules/src/View/Select/HtmlView.php b/administrator/components/com_modules/src/View/Select/HtmlView.php
index c2ff9fa1438cd..6dd9e81a3b5fe 100644
--- a/administrator/components/com_modules/src/View/Select/HtmlView.php
+++ b/administrator/components/com_modules/src/View/Select/HtmlView.php
@@ -82,6 +82,7 @@ protected function addToolbar()
{
$state = $this->get('State');
$clientId = (int) $state->get('client_id', 0);
+ $toolbar = Toolbar::getInstance();
// Add page title
ToolbarHelper::title(Text::_('COM_MODULES_MANAGER_MODULES_SITE'), 'cube module');
@@ -90,12 +91,10 @@ protected function addToolbar()
ToolbarHelper::title(Text::_('COM_MODULES_MANAGER_MODULES_ADMIN'), 'cube module');
}
- // Get the toolbar object instance
- $bar = Toolbar::getInstance('toolbar');
-
// Instantiate a new FileLayout instance and render the layout
$layout = new FileLayout('toolbar.cancelselect');
- $bar->appendButton('Custom', $layout->render(['client_id' => $clientId]), 'new');
+ $toolbar->customButton('new')
+ ->html($layout->render(['client_id' => $clientId]));
}
}
diff --git a/administrator/components/com_newsfeeds/src/View/Newsfeed/HtmlView.php b/administrator/components/com_newsfeeds/src/View/Newsfeed/HtmlView.php
index ec3f49cba8f5e..c36277411c86e 100644
--- a/administrator/components/com_newsfeeds/src/View/Newsfeed/HtmlView.php
+++ b/administrator/components/com_newsfeeds/src/View/Newsfeed/HtmlView.php
@@ -17,6 +17,7 @@
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
+use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
// phpcs:disable PSR1.Files.SideEffects
@@ -108,6 +109,7 @@ protected function addToolbar()
$user = $this->getCurrentUser();
$isNew = ($this->item->id == 0);
$checkedOut = !(is_null($this->item->checked_out) || $this->item->checked_out == $user->get('id'));
+ $toolbar = Toolbar::getInstance();
// Since we don't track these assets at the item level, use the category id.
$canDo = ContentHelper::getActions('com_newsfeeds', 'category', $this->item->catid);
@@ -115,44 +117,48 @@ protected function addToolbar()
$title = $isNew ? Text::_('COM_NEWSFEEDS_MANAGER_NEWSFEED_NEW') : Text::_('COM_NEWSFEEDS_MANAGER_NEWSFEED_EDIT');
ToolbarHelper::title($title, 'rss newsfeeds');
- $toolbarButtons = [];
-
// If not checked out, can save the item.
if (!$checkedOut && ($canDo->get('core.edit') || count($user->getAuthorisedCategories('com_newsfeeds', 'core.create')) > 0)) {
- ToolbarHelper::apply('newsfeed.apply');
-
- $toolbarButtons[] = ['save', 'newsfeed.save'];
+ $toolbar->apply('newsfeed.apply');
}
- if (!$checkedOut && count($user->getAuthorisedCategories('com_newsfeeds', 'core.create')) > 0) {
- $toolbarButtons[] = ['save2new', 'newsfeed.save2new'];
- }
+ $saveGroup = $toolbar->dropdownButton('save-group');
- // If an existing item, can save to a copy.
- if (!$isNew && $canDo->get('core.create')) {
- $toolbarButtons[] = ['save2copy', 'newsfeed.save2copy'];
- }
+ $saveGroup->configure(
+ function (Toolbar $childBar) use ($checkedOut, $canDo, $user, $isNew) {
+ // If not checked out, can save the item.
+ if (!$checkedOut && ($canDo->get('core.edit') || count($user->getAuthorisedCategories('com_newsfeeds', 'core.create')) > 0)) {
+ $childBar->save('newsfeed.save');
+ }
+
+ if (!$checkedOut && count($user->getAuthorisedCategories('com_newsfeeds', 'core.create')) > 0) {
+ $childBar->save2new('newsfeed.save2new');
+ }
- ToolbarHelper::saveGroup(
- $toolbarButtons,
- 'btn-success'
+ // If an existing item, can save to a copy.
+ if (!$isNew && $canDo->get('core.create')) {
+ $childBar->save2copy('newsfeed.save2copy');
+ }
+ }
);
if (empty($this->item->id)) {
- ToolbarHelper::cancel('newsfeed.cancel');
+ $toolbar->cancel('newsfeed.cancel', 'JTOOLBAR_CANCEL');
} else {
- ToolbarHelper::cancel('newsfeed.cancel', 'JTOOLBAR_CLOSE');
+ $toolbar->cancel('newsfeed.cancel');
if (ComponentHelper::isEnabled('com_contenthistory') && $this->state->params->get('save_history', 0) && $canDo->get('core.edit')) {
- ToolbarHelper::versions('com_newsfeeds.newsfeed', $this->item->id);
+ $toolbar->versions('com_newsfeeds.newsfeed', $this->item->id);
}
}
if (!$isNew && Associations::isEnabled() && ComponentHelper::isEnabled('com_associations')) {
- ToolbarHelper::custom('newsfeed.editAssociations', 'contract', '', 'JTOOLBAR_ASSOCIATIONS', false, false);
+ $toolbar->standardButton('associations', 'JTOOLBAR_ASSOCIATIONS', 'newsfeed.editAssociations')
+ ->icon('icon-contract')
+ ->listCheck(false);
}
- ToolbarHelper::divider();
- ToolbarHelper::help('News_Feeds:_New_or_Edit');
+ $toolbar->divider();
+ $toolbar->help('News_Feeds:_New_or_Edit');
}
}
diff --git a/administrator/components/com_newsfeeds/src/View/Newsfeeds/HtmlView.php b/administrator/components/com_newsfeeds/src/View/Newsfeeds/HtmlView.php
index d044094c21645..8c6e81db4856f 100644
--- a/administrator/components/com_newsfeeds/src/View/Newsfeeds/HtmlView.php
+++ b/administrator/components/com_newsfeeds/src/View/Newsfeeds/HtmlView.php
@@ -17,6 +17,7 @@
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Object\CMSObject;
+use Joomla\CMS\Toolbar\Button\DropdownButton;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
@@ -130,12 +131,10 @@ public function display($tpl = null)
*/
protected function addToolbar()
{
- $state = $this->get('State');
- $canDo = ContentHelper::getActions('com_newsfeeds', 'category', $state->get('filter.category_id'));
- $user = Factory::getApplication()->getIdentity();
-
- // Get the toolbar object instance
- $toolbar = Toolbar::getInstance('toolbar');
+ $state = $this->get('State');
+ $canDo = ContentHelper::getActions('com_newsfeeds', 'category', $state->get('filter.category_id'));
+ $user = Factory::getApplication()->getIdentity();
+ $toolbar = Toolbar::getInstance();
ToolbarHelper::title(Text::_('COM_NEWSFEEDS_MANAGER_NEWSFEEDS'), 'rss newsfeeds');
@@ -144,8 +143,8 @@ protected function addToolbar()
}
if (!$this->isEmptyState && ($canDo->get('core.edit.state') || $user->authorise('core.admin'))) {
- $dropdown = $toolbar->dropdownButton('status-group')
- ->text('JTOOLBAR_CHANGE_STATUS')
+ /** @var DropdownButton $dropdown */
+ $dropdown = $toolbar->dropdownButton('status-group', 'JTOOLBAR_CHANGE_STATUS')
->toggleSplit(false)
->icon('icon-ellipsis-h')
->buttonClass('btn btn-action')
@@ -171,16 +170,14 @@ protected function addToolbar()
&& $user->authorise('core.edit', 'com_newsfeeds')
&& $user->authorise('core.edit.state', 'com_newsfeeds')
) {
- $childBar->popupButton('batch')
- ->text('JTOOLBAR_BATCH')
+ $childBar->popupButton('batch', 'JTOOLBAR_BATCH')
->selector('collapseModal')
->listCheck(true);
}
}
if (!$this->isEmptyState && $state->get('filter.published') == -2 && $canDo->get('core.delete')) {
- $toolbar->delete('newsfeeds.delete')
- ->text('JTOOLBAR_EMPTY_TRASH')
+ $toolbar->delete('newsfeeds.delete', 'JTOOLBAR_EMPTY_TRASH')
->message('JGLOBAL_CONFIRM_DELETE')
->listCheck(true);
}
diff --git a/administrator/components/com_plugins/src/View/Plugin/HtmlView.php b/administrator/components/com_plugins/src/View/Plugin/HtmlView.php
index 35ef7e9b099fd..d7dc0ac48399d 100644
--- a/administrator/components/com_plugins/src/View/Plugin/HtmlView.php
+++ b/administrator/components/com_plugins/src/View/Plugin/HtmlView.php
@@ -16,6 +16,7 @@
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Object\CMSObject;
+use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
// phpcs:disable PSR1.Files.SideEffects
@@ -83,19 +84,20 @@ protected function addToolbar()
{
Factory::getApplication()->getInput()->set('hidemainmenu', true);
- $canDo = ContentHelper::getActions('com_plugins');
+ $canDo = ContentHelper::getActions('com_plugins');
+ $toolbar = Toolbar::getInstance();
ToolbarHelper::title(Text::sprintf('COM_PLUGINS_MANAGER_PLUGIN', Text::_($this->item->name)), 'plug plugin');
// If not checked out, can save the item.
if ($canDo->get('core.edit')) {
- ToolbarHelper::apply('plugin.apply');
+ $toolbar->apply('plugin.apply');
- ToolbarHelper::save('plugin.save');
+ $toolbar->save('plugin.save');
}
- ToolbarHelper::cancel('plugin.cancel', 'JTOOLBAR_CLOSE');
- ToolbarHelper::divider();
+ $toolbar->cancel('plugin.cancel');
+ $toolbar->divider();
// Get the help information for the plugin item.
$lang = Factory::getLanguage();
@@ -110,7 +112,7 @@ protected function addToolbar()
$url = null;
}
- ToolbarHelper::inlinehelp();
- ToolbarHelper::help($help->key, false, $url);
+ $toolbar->inlinehelp();
+ $toolbar->help($help->key, false, $url);
}
}
diff --git a/administrator/components/com_plugins/src/View/Plugins/HtmlView.php b/administrator/components/com_plugins/src/View/Plugins/HtmlView.php
index ef18432db0a73..5341952860303 100644
--- a/administrator/components/com_plugins/src/View/Plugins/HtmlView.php
+++ b/administrator/components/com_plugins/src/View/Plugins/HtmlView.php
@@ -99,17 +99,15 @@ public function display($tpl = null)
*/
protected function addToolbar()
{
- $canDo = ContentHelper::getActions('com_plugins');
+ $canDo = ContentHelper::getActions('com_plugins');
+ $toolbar = Toolbar::getInstance();
ToolbarHelper::title(Text::_('COM_PLUGINS_MANAGER_PLUGINS'), 'plug plugin');
- // Get the toolbar object instance
- $toolbar = Toolbar::getInstance('toolbar');
-
if ($canDo->get('core.edit.state')) {
$toolbar->publish('plugins.publish', 'JTOOLBAR_ENABLE')->listCheck(true);
$toolbar->unpublish('plugins.unpublish', 'JTOOLBAR_DISABLE')->listCheck(true);
- $toolbar->checkin('plugins.checkin')->listCheck(true);
+ $toolbar->checkin('plugins.checkin');
}
if ($canDo->get('core.admin')) {
diff --git a/administrator/components/com_postinstall/src/View/Messages/HtmlView.php b/administrator/components/com_postinstall/src/View/Messages/HtmlView.php
index ee9bedddd4771..c4054fd77f5f6 100644
--- a/administrator/components/com_postinstall/src/View/Messages/HtmlView.php
+++ b/administrator/components/com_postinstall/src/View/Messages/HtmlView.php
@@ -74,7 +74,7 @@ public function display($tpl = null)
*/
private function toolbar()
{
- $toolbar = Toolbar::getInstance('toolbar');
+ $toolbar = Toolbar::getInstance();
if (!empty($this->items)) {
$toolbar->unpublish('message.hideAll', 'COM_POSTINSTALL_HIDE_ALL_MESSAGES');
diff --git a/administrator/components/com_privacy/src/View/Capabilities/HtmlView.php b/administrator/components/com_privacy/src/View/Capabilities/HtmlView.php
index 7f31a86840bd7..8e7d0a45179f5 100644
--- a/administrator/components/com_privacy/src/View/Capabilities/HtmlView.php
+++ b/administrator/components/com_privacy/src/View/Capabilities/HtmlView.php
@@ -14,6 +14,7 @@
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Object\CMSObject;
+use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
// phpcs:disable PSR1.Files.SideEffects
@@ -79,10 +80,11 @@ public function display($tpl = null)
*/
protected function addToolbar()
{
- ToolbarHelper::title(Text::_('COM_PRIVACY_VIEW_CAPABILITIES'), 'lock');
+ $toolbar = Toolbar::getInstance();
- ToolbarHelper::preferences('com_privacy');
+ ToolbarHelper::title(Text::_('COM_PRIVACY_VIEW_CAPABILITIES'), 'lock');
- ToolbarHelper::help('Privacy:_Extension_Capabilities');
+ $toolbar->preferences('com_privacy');
+ $toolbar->help('Privacy:_Extension_Capabilities');
}
}
diff --git a/administrator/components/com_privacy/src/View/Consents/HtmlView.php b/administrator/components/com_privacy/src/View/Consents/HtmlView.php
index 415895a0c57fb..4b288a5908676 100644
--- a/administrator/components/com_privacy/src/View/Consents/HtmlView.php
+++ b/administrator/components/com_privacy/src/View/Consents/HtmlView.php
@@ -127,34 +127,25 @@ protected function addToolbar()
{
ToolbarHelper::title(Text::_('COM_PRIVACY_VIEW_CONSENTS'), 'lock');
- $bar = Toolbar::getInstance('toolbar');
+ $toolbar = Toolbar::getInstance();
// Add a button to invalidate a consent
if (!$this->isEmptyState) {
- $bar->appendButton(
- 'Confirm',
- 'COM_PRIVACY_CONSENTS_TOOLBAR_INVALIDATE_CONFIRM_MSG',
- 'trash',
- 'COM_PRIVACY_CONSENTS_TOOLBAR_INVALIDATE',
- 'consents.invalidate',
- true
- );
+ $toolbar->confirmButton('trash', 'COM_PRIVACY_CONSENTS_TOOLBAR_INVALIDATE', 'consents.invalidate')
+ ->message('COM_PRIVACY_CONSENTS_TOOLBAR_INVALIDATE')
+ ->icon('icon-trash')
+ ->listCheck(true);
}
// If the filter is restricted to a specific subject, show the "Invalidate all" button
if ($this->state->get('filter.subject') != '') {
- $bar->appendButton(
- 'Confirm',
- 'COM_PRIVACY_CONSENTS_TOOLBAR_INVALIDATE_ALL_CONFIRM_MSG',
- 'cancel',
- 'COM_PRIVACY_CONSENTS_TOOLBAR_INVALIDATE_ALL',
- 'consents.invalidateAll',
- false
- );
+ $toolbar->confirmButton('cancel', 'COM_PRIVACY_CONSENTS_TOOLBAR_INVALIDATE_ALL', 'consents.invalidateAll')
+ ->message('COM_PRIVACY_CONSENTS_TOOLBAR_INVALIDATE_ALL_CONFIRM_MSG')
+ ->icon('icon-cancel')
+ ->listCheck(false);
}
- ToolbarHelper::preferences('com_privacy');
-
- ToolbarHelper::help('Privacy:_Consents');
+ $toolbar->preferences('com_privacy');
+ $toolbar->help('Privacy:_Consents');
}
}
diff --git a/administrator/components/com_privacy/src/View/Request/HtmlView.php b/administrator/components/com_privacy/src/View/Request/HtmlView.php
index df46d3cf35107..038d7401ef30e 100644
--- a/administrator/components/com_privacy/src/View/Request/HtmlView.php
+++ b/administrator/components/com_privacy/src/View/Request/HtmlView.php
@@ -122,52 +122,53 @@ protected function addToolbar()
{
Factory::getApplication()->getInput()->set('hidemainmenu', true);
+ $toolbar = Toolbar::getInstance();
+
// Set the title and toolbar based on the layout
if ($this->getLayout() === 'edit') {
ToolbarHelper::title(Text::_('COM_PRIVACY_VIEW_REQUEST_ADD_REQUEST'), 'lock');
- ToolbarHelper::save('request.save');
- ToolbarHelper::cancel('request.cancel');
- ToolbarHelper::help('Privacy:_New_Information_Request');
+ $toolbar->save('request.save');
+ $toolbar->cancel('request.cancel');
+ $toolbar->help('Privacy:_New_Information_Request');
} else {
ToolbarHelper::title(Text::_('COM_PRIVACY_VIEW_REQUEST_SHOW_REQUEST'), 'lock');
- $bar = Toolbar::getInstance('toolbar');
-
// Add transition and action buttons based on item status
switch ($this->item->status) {
case '0':
- $bar->appendButton('Standard', 'cancel-circle', 'COM_PRIVACY_TOOLBAR_INVALIDATE', 'request.invalidate', false);
+ $toolbar->standardButton('cancel', 'COM_PRIVACY_TOOLBAR_INVALIDATE', 'request.invalidate')
+ ->listCheck(false)
+ ->icon('icon-cancel-circle');
break;
case '1':
$return = '&return=' . base64_encode('index.php?option=com_privacy&view=request&id=' . (int) $this->item->id);
- $bar->appendButton('Standard', 'apply', 'COM_PRIVACY_TOOLBAR_COMPLETE', 'request.complete', false);
- $bar->appendButton('Standard', 'cancel-circle', 'COM_PRIVACY_TOOLBAR_INVALIDATE', 'request.invalidate', false);
+ $toolbar->standardButton('apply', 'COM_PRIVACY_TOOLBAR_COMPLETE', 'request.complete')
+ ->listCheck(false)
+ ->icon('icon-apply');
+
+ $toolbar->standardButton('invalidate', 'COM_PRIVACY_TOOLBAR_INVALIDATE', 'request.invalidate')
+ ->listCheck(false)
+ ->icon('icon-cancel-circle');
if ($this->item->request_type === 'export') {
- ToolbarHelper::link(
- Route::_('index.php?option=com_privacy&task=request.export&format=xml&id=' . (int) $this->item->id . $return),
- 'COM_PRIVACY_ACTION_EXPORT_DATA',
- 'download'
- );
+ $toolbar->linkButton('download', 'COM_PRIVACY_ACTION_EXPORT_DATA')
+ ->url(Route::_('index.php?option=com_privacy&task=request.export&format=xml&id=' . (int) $this->item->id . $return));
if (Factory::getApplication()->get('mailonline', 1)) {
- ToolbarHelper::link(
- Route::_(
- 'index.php?option=com_privacy&task=request.emailexport&id=' . (int) $this->item->id . $return
- . '&' . Session::getFormToken() . '=1'
- ),
- 'COM_PRIVACY_ACTION_EMAIL_EXPORT_DATA',
- 'mail'
- );
+ $toolbar->linkButton('mail', 'COM_PRIVACY_ACTION_EMAIL_EXPORT_DATA')
+ ->url(Route::_('index.php?option=com_privacy&task=request.emailexport&id=' . (int) $this->item->id . $return
+ . '&' . Session::getFormToken() . '=1'));
}
}
if ($this->item->request_type === 'remove') {
- $bar->appendButton('Standard', 'delete', 'COM_PRIVACY_ACTION_DELETE_DATA', 'request.remove', false);
+ $toolbar->standardButton('delete', 'COM_PRIVACY_ACTION_DELETE_DATA', 'request.remove')
+ ->listCheck(false)
+ ->icon('icon-delete');
}
break;
@@ -177,8 +178,8 @@ protected function addToolbar()
break;
}
- ToolbarHelper::cancel('request.cancel', 'JTOOLBAR_CLOSE');
- ToolbarHelper::help('Privacy:_Review_Information_Request');
+ $toolbar->cancel('request.cancel');
+ $toolbar->help('Privacy:_Review_Information_Request');
}
}
}
diff --git a/administrator/components/com_privacy/src/View/Requests/HtmlView.php b/administrator/components/com_privacy/src/View/Requests/HtmlView.php
index 351cb4d362c84..d934ce2f5c3b1 100644
--- a/administrator/components/com_privacy/src/View/Requests/HtmlView.php
+++ b/administrator/components/com_privacy/src/View/Requests/HtmlView.php
@@ -18,6 +18,7 @@
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Object\CMSObject;
use Joomla\CMS\Pagination\Pagination;
+use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\Component\Privacy\Administrator\Model\RequestsModel;
@@ -138,12 +139,14 @@ protected function addToolbar()
{
ToolbarHelper::title(Text::_('COM_PRIVACY_VIEW_REQUESTS'), 'lock');
+ $toolbar = Toolbar::getInstance();
+
// Requests can only be created if mail sending is enabled
if (Factory::getApplication()->get('mailonline', 1)) {
- ToolbarHelper::addNew('request.add');
+ $toolbar->addNew('request.add');
}
- ToolbarHelper::preferences('com_privacy');
- ToolbarHelper::help('Privacy:_Information_Requests');
+ $toolbar->preferences('com_privacy');
+ $toolbar->help('Privacy:_Information_Requests');
}
}
diff --git a/administrator/components/com_redirect/src/View/Link/HtmlView.php b/administrator/components/com_redirect/src/View/Link/HtmlView.php
index f3bd285b5b4d6..ed515f061d476 100644
--- a/administrator/components/com_redirect/src/View/Link/HtmlView.php
+++ b/administrator/components/com_redirect/src/View/Link/HtmlView.php
@@ -15,6 +15,7 @@
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
+use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
// phpcs:disable PSR1.Files.SideEffects
@@ -84,39 +85,42 @@ protected function addToolbar()
{
Factory::getApplication()->getInput()->set('hidemainmenu', true);
- $isNew = ($this->item->id == 0);
- $canDo = ContentHelper::getActions('com_redirect');
+ $isNew = ($this->item->id == 0);
+ $canDo = ContentHelper::getActions('com_redirect');
+ $toolbar = Toolbar::getInstance();
ToolbarHelper::title($isNew ? Text::_('COM_REDIRECT_MANAGER_LINK_NEW') : Text::_('COM_REDIRECT_MANAGER_LINK_EDIT'), 'map-signs redirect');
- $toolbarButtons = [];
-
- // If not checked out, can save the item.
if ($canDo->get('core.edit')) {
- ToolbarHelper::apply('link.apply');
- $toolbarButtons[] = ['save', 'link.save'];
- }
-
- /**
- * This component does not support Save as Copy due to uniqueness checks.
- * While it can be done, it causes too much confusion if the user does
- * not change the Old URL.
- */
- if ($canDo->get('core.edit') && $canDo->get('core.create')) {
- $toolbarButtons[] = ['save2new', 'link.save2new'];
+ $toolbar->apply('link.apply');
}
- ToolbarHelper::saveGroup(
- $toolbarButtons,
- 'btn-success'
+ $saveGroup = $toolbar->dropdownButton('save-group');
+
+ $saveGroup->configure(
+ function (Toolbar $childBar) use ($canDo) {
+ // If not checked out, can save the item.
+ if ($canDo->get('core.edit')) {
+ $childBar->save('link.save');
+ }
+
+ /**
+ * This component does not support Save as Copy due to uniqueness checks.
+ * While it can be done, it causes too much confusion if the user does
+ * not change the Old URL.
+ */
+ if ($canDo->get('core.edit') && $canDo->get('core.create')) {
+ $childBar->save2new('link.save2new');
+ }
+ }
);
if (empty($this->item->id)) {
- ToolbarHelper::cancel('link.cancel');
+ $toolbar->cancel('link.cancel', 'JTOOLBAR_CANCEL');
} else {
- ToolbarHelper::cancel('link.cancel', 'JTOOLBAR_CLOSE');
+ $toolbar->cancel('link.cancel');
}
- ToolbarHelper::help('Redirects:_New_or_Edit');
+ $toolbar->help('Redirects:_New_or_Edit');
}
}
diff --git a/administrator/components/com_redirect/src/View/Links/HtmlView.php b/administrator/components/com_redirect/src/View/Links/HtmlView.php
index 74b8585f7c5a5..8839b9d694f9b 100644
--- a/administrator/components/com_redirect/src/View/Links/HtmlView.php
+++ b/administrator/components/com_redirect/src/View/Links/HtmlView.php
@@ -16,6 +16,7 @@
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Plugin\PluginHelper;
+use Joomla\CMS\Toolbar\Button\DropdownButton;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\Component\Redirect\Administrator\Helper\RedirectHelper;
@@ -153,10 +154,9 @@ public function display($tpl = null)
*/
protected function addToolbar()
{
- $state = $this->get('State');
- $canDo = ContentHelper::getActions('com_redirect');
-
- $toolbar = Toolbar::getInstance('toolbar');
+ $state = $this->get('State');
+ $canDo = ContentHelper::getActions('com_redirect');
+ $toolbar = Toolbar::getInstance();
ToolbarHelper::title(Text::_('COM_REDIRECT_MANAGER_LINKS'), 'map-signs redirect');
@@ -165,8 +165,8 @@ protected function addToolbar()
}
if (!$this->isEmptyState && ($canDo->get('core.edit.state') || $canDo->get('core.admin'))) {
- $dropdown = $toolbar->dropdownButton('status-group')
- ->text('JTOOLBAR_CHANGE_STATUS')
+ /** @var DropdownButton $dropdown */
+ $dropdown = $toolbar->dropdownButton('status-group', 'JTOOLBAR_CHANGE_STATUS')
->toggleSplit(false)
->icon('icon-ellipsis-h')
->buttonClass('btn btn-action')
@@ -193,22 +193,18 @@ protected function addToolbar()
}
if ($state->get('filter.state') == -2 && $canDo->get('core.delete')) {
- $toolbar->delete('links.delete')
- ->text('JTOOLBAR_EMPTY_TRASH')
+ $toolbar->delete('links.delete', 'JTOOLBAR_EMPTY_TRASH')
->message('JGLOBAL_CONFIRM_DELETE')
->listCheck(true);
}
if (!$this->isEmptyState && (!$state->get('filter.state') == -2 && $canDo->get('core.delete'))) {
- $toolbar->confirmButton('delete')
- ->text('COM_REDIRECT_TOOLBAR_PURGE')
- ->message('COM_REDIRECT_CONFIRM_PURGE')
- ->task('links.purge');
+ $toolbar->confirmButton('delete', 'COM_REDIRECT_TOOLBAR_PURGE', 'links.purge')
+ ->message('COM_REDIRECT_CONFIRM_PURGE');
}
if ($canDo->get('core.create')) {
- $toolbar->popupButton('batch')
- ->text('JTOOLBAR_BULK_IMPORT')
+ $toolbar->popupButton('batch', 'JTOOLBAR_BULK_IMPORT')
->selector('collapseModal')
->listCheck(false);
}
diff --git a/administrator/components/com_scheduler/src/View/Select/HtmlView.php b/administrator/components/com_scheduler/src/View/Select/HtmlView.php
index 2e9061c0f9cc8..526f8ee450b49 100644
--- a/administrator/components/com_scheduler/src/View/Select/HtmlView.php
+++ b/administrator/components/com_scheduler/src/View/Select/HtmlView.php
@@ -118,14 +118,8 @@ public function display($tpl = null): void
*/
protected function addToolbar(): void
{
- /*
- * Get the global Toolbar instance
- * @todo : Replace usage with ToolbarFactoryInterface. but how?
- * Probably some changes in the core, since mod_menu calls and renders the getInstance() toolbar
- */
$toolbar = Toolbar::getInstance();
- // Add page title
ToolbarHelper::title(Text::_('COM_SCHEDULER_MANAGER_TASKS'), 'clock');
$toolbar->linkButton('cancel')
diff --git a/administrator/components/com_scheduler/src/View/Task/HtmlView.php b/administrator/components/com_scheduler/src/View/Task/HtmlView.php
index 3fca2a4d04be4..47fc5fe629d42 100644
--- a/administrator/components/com_scheduler/src/View/Task/HtmlView.php
+++ b/administrator/components/com_scheduler/src/View/Task/HtmlView.php
@@ -124,16 +124,10 @@ public function display($tpl = null): void
*/
protected function addToolbar(): void
{
- $app = $this->app;
+ $this->app->getInput()->set('hidemainmenu', true);
- $app->getInput()->set('hidemainmenu', true);
- $isNew = ($this->item->id == 0);
- $canDo = $this->canDo;
-
- /*
- * Get the toolbar object instance
- * !! @todo : Replace usage with ToolbarFactoryInterface
- */
+ $isNew = ($this->item->id == 0);
+ $canDo = $this->canDo;
$toolbar = Toolbar::getInstance();
ToolbarHelper::title($isNew ? Text::_('COM_SCHEDULER_MANAGER_TASK_NEW') : Text::_('COM_SCHEDULER_MANAGER_TASK_EDIT'), 'clock');
diff --git a/administrator/components/com_scheduler/src/View/Tasks/HtmlView.php b/administrator/components/com_scheduler/src/View/Tasks/HtmlView.php
index 3dceb534eb6ce..3ab02c28e78a7 100644
--- a/administrator/components/com_scheduler/src/View/Tasks/HtmlView.php
+++ b/administrator/components/com_scheduler/src/View/Tasks/HtmlView.php
@@ -127,13 +127,8 @@ public function display($tpl = null): void
*/
protected function addToolbar(): void
{
- $canDo = ContentHelper::getActions('com_scheduler');
- $user = Factory::getApplication()->getIdentity();
-
- /*
- * Get the toolbar object instance
- * !! @todo : Replace usage with ToolbarFactoryInterface
- */
+ $canDo = ContentHelper::getActions('com_scheduler');
+ $user = Factory::getApplication()->getIdentity();
$toolbar = Toolbar::getInstance();
ToolbarHelper::title(Text::_('COM_SCHEDULER_MANAGER_TASKS'), 'clock');
@@ -162,10 +157,10 @@ protected function addToolbar(): void
$childBar->unpublish('tasks.unpublish', 'JTOOLBAR_DISABLE')->listCheck(true);
if ($canDo->get('core.admin')) {
- $childBar->checkin('tasks.checkin')->listCheck(true);
+ $childBar->checkin('tasks.checkin');
}
- $childBar->checkin('tasks.unlock', 'COM_SCHEDULER_TOOLBAR_UNLOCK')->listCheck(true)->icon('icon-unlock');
+ $childBar->checkin('tasks.unlock', 'COM_SCHEDULER_TOOLBAR_UNLOCK')->icon('icon-unlock');
// We don't want the batch Trash button if displayed entries are all trashed
if ($this->state->get('filter.state') != -2) {
@@ -176,9 +171,8 @@ protected function addToolbar(): void
// Add "Empty Trash" button if filtering by trashed.
if ($this->state->get('filter.state') == -2 && $canDo->get('core.delete')) {
- $toolbar->delete('tasks.delete')
+ $toolbar->delete('tasks.delete', 'JTOOLBAR_EMPTY_TRASH')
->message('JGLOBAL_CONFIRM_DELETE')
- ->text('JTOOLBAR_EMPTY_TRASH')
->listCheck(true);
}
diff --git a/administrator/components/com_tags/src/View/Tag/HtmlView.php b/administrator/components/com_tags/src/View/Tag/HtmlView.php
index ab233fe8b9453..c40ed9e519e69 100644
--- a/administrator/components/com_tags/src/View/Tag/HtmlView.php
+++ b/administrator/components/com_tags/src/View/Tag/HtmlView.php
@@ -17,6 +17,7 @@
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Object\CMSObject;
+use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
// phpcs:disable PSR1.Files.SideEffects
@@ -105,6 +106,7 @@ protected function addToolbar()
$userId = $user->get('id');
$isNew = ($this->item->id == 0);
$checkedOut = !(is_null($this->item->checked_out) || $this->item->checked_out == $userId);
+ $toolbar = Toolbar::getInstance();
$canDo = ContentHelper::getActions('com_tags');
@@ -112,51 +114,55 @@ protected function addToolbar()
// Build the actions for new and existing records.
if ($isNew) {
- ToolbarHelper::apply('tag.apply');
- ToolbarHelper::saveGroup(
- [
- ['save', 'tag.save'],
- ['save2new', 'tag.save2new']
- ],
- 'btn-success'
+ $toolbar->apply('tag.apply');
+ $saveGroup = $toolbar->dropdownButton('save-group');
+
+ $saveGroup->configure(
+ function (Toolbar $childBar) {
+ $childBar->save('tag.save');
+ $childBar->save2new('tag.save2new');
+ }
);
- ToolbarHelper::cancel('tag.cancel');
+ $toolbar->cancel('tag.cancel', 'JTOOLBAR_CANCEL');
} else {
// Since it's an existing record, check the edit permission, or fall back to edit own if the owner.
$itemEditable = $canDo->get('core.edit') || ($canDo->get('core.edit.own') && $this->item->created_user_id == $userId);
- $toolbarButtons = [];
-
// Can't save the record if it's checked out and editable
if (!$checkedOut && $itemEditable) {
- ToolbarHelper::apply('tag.apply');
- $toolbarButtons[] = ['save', 'tag.save'];
-
- // We can save this record, but check the create permission to see if we can return to make a new one.
- if ($canDo->get('core.create')) {
- $toolbarButtons[] = ['save2new', 'tag.save2new'];
- }
+ $toolbar->apply('tag.apply');
}
- // If checked out, we can still save
- if ($canDo->get('core.create')) {
- $toolbarButtons[] = ['save2copy', 'tag.save2copy'];
- }
+ $saveGroup = $toolbar->dropdownButton('save-group');
+
+ $saveGroup->configure(
+ function (Toolbar $childBar) use ($checkedOut, $itemEditable, $canDo) {
+ // Can't save the record if it's checked out and editable
+ if (!$checkedOut && $itemEditable) {
+ $childBar->save('tag.save');
- ToolbarHelper::saveGroup(
- $toolbarButtons,
- 'btn-success'
+ // We can save this record, but check the create permission to see if we can return to make a new one.
+ if ($canDo->get('core.create')) {
+ $childBar->save2new('tag.save2new');
+ }
+ }
+
+ // If checked out, we can still save
+ if ($canDo->get('core.create')) {
+ $childBar->save2copy('tag.save2copy');
+ }
+ }
);
- ToolbarHelper::cancel('tag.cancel', 'JTOOLBAR_CLOSE');
+ $toolbar->cancel('tag.cancel');
if (ComponentHelper::isEnabled('com_contenthistory') && $this->state->params->get('save_history', 0) && $itemEditable) {
- ToolbarHelper::versions('com_tags.tag', $this->item->id);
+ $toolbar->versions('com_tags.tag', $this->item->id);
}
}
- ToolbarHelper::divider();
- ToolbarHelper::help('Tags:_New_or_Edit');
+ $toolbar->divider();
+ $toolbar->help('Tags:_New_or_Edit');
}
}
diff --git a/administrator/components/com_tags/src/View/Tags/HtmlView.php b/administrator/components/com_tags/src/View/Tags/HtmlView.php
index 57dd69033e723..7179dc0a011a5 100644
--- a/administrator/components/com_tags/src/View/Tags/HtmlView.php
+++ b/administrator/components/com_tags/src/View/Tags/HtmlView.php
@@ -17,6 +17,7 @@
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Object\CMSObject;
+use Joomla\CMS\Toolbar\Button\DropdownButton;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
@@ -131,11 +132,9 @@ public function display($tpl = null)
*/
protected function addToolbar()
{
- $canDo = ContentHelper::getActions('com_tags');
- $user = Factory::getApplication()->getIdentity();
-
- // Get the toolbar object instance
- $toolbar = Toolbar::getInstance('toolbar');
+ $canDo = ContentHelper::getActions('com_tags');
+ $user = Factory::getApplication()->getIdentity();
+ $toolbar = Toolbar::getInstance();
ToolbarHelper::title(Text::_('COM_TAGS_MANAGER_TAGS'), 'tags');
@@ -144,8 +143,8 @@ protected function addToolbar()
}
if (!$this->isEmptyState && ($canDo->get('core.edit.state') || $user->authorise('core.admin'))) {
- $dropdown = $toolbar->dropdownButton('status-group')
- ->text('JTOOLBAR_CHANGE_STATUS')
+ /** @var DropdownButton $dropdown */
+ $dropdown = $toolbar->dropdownButton('status-group', 'JTOOLBAR_CHANGE_STATUS')
->toggleSplit(false)
->icon('icon-ellipsis-h')
->buttonClass('btn btn-action')
@@ -169,16 +168,14 @@ protected function addToolbar()
// Add a batch button
if ($canDo->get('core.create') && $canDo->get('core.edit') && $canDo->get('core.edit.state')) {
- $childBar->popupButton('batch')
- ->text('JTOOLBAR_BATCH')
+ $childBar->popupButton('batch', 'JTOOLBAR_BATCH')
->selector('collapseModal')
->listCheck(true);
}
}
if (!$this->isEmptyState && $this->state->get('filter.published') == -2 && $canDo->get('core.delete')) {
- $toolbar->delete('tags.delete')
- ->text('JTOOLBAR_EMPTY_TRASH')
+ $toolbar->delete('tags.delete', 'JTOOLBAR_EMPTY_TRASH')
->message('JGLOBAL_CONFIRM_DELETE')
->listCheck(true);
}
diff --git a/administrator/components/com_templates/src/View/Style/HtmlView.php b/administrator/components/com_templates/src/View/Style/HtmlView.php
index d2c06e616577d..d66158e1b8650 100644
--- a/administrator/components/com_templates/src/View/Style/HtmlView.php
+++ b/administrator/components/com_templates/src/View/Style/HtmlView.php
@@ -16,6 +16,7 @@
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Object\CMSObject;
+use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
// phpcs:disable PSR1.Files.SideEffects
@@ -96,8 +97,9 @@ protected function addToolbar()
{
Factory::getApplication()->getInput()->set('hidemainmenu', true);
- $isNew = ($this->item->id == 0);
- $canDo = $this->canDo;
+ $isNew = ($this->item->id == 0);
+ $canDo = $this->canDo;
+ $toolbar = Toolbar::getInstance();
ToolbarHelper::title(
$isNew ? Text::_('COM_TEMPLATES_MANAGER_ADD_STYLE')
@@ -105,31 +107,34 @@ protected function addToolbar()
'paint-brush thememanager'
);
- $toolbarButtons = [];
-
// If not checked out, can save the item.
if ($canDo->get('core.edit')) {
- ToolbarHelper::apply('style.apply');
- $toolbarButtons[] = ['save', 'style.save'];
+ $toolbar->apply('style.apply');
}
- // If an existing item, can save to a copy.
- if (!$isNew && $canDo->get('core.create')) {
- $toolbarButtons[] = ['save2copy', 'style.save2copy'];
- }
+ $saveGroup = $toolbar->dropdownButton('save-group');
+
+ $saveGroup->configure(
+ function (Toolbar $childBar) use ($canDo, $isNew) {
+ // If not checked out, can save the item.
+ if ($canDo->get('core.edit')) {
+ $childBar->save('style.save');
+ }
- ToolbarHelper::saveGroup(
- $toolbarButtons,
- 'btn-success'
+ // If an existing item, can save to a copy.
+ if (!$isNew && $canDo->get('core.create')) {
+ $childBar->save2copy('style.save2copy');
+ }
+ }
);
if (empty($this->item->id)) {
- ToolbarHelper::cancel('style.cancel');
+ $toolbar->cancel('style.cancel', 'JTOOLBAR_CANCEL');
} else {
- ToolbarHelper::cancel('style.cancel', 'JTOOLBAR_CLOSE');
+ $toolbar->cancel('style.cancel');
}
- ToolbarHelper::divider();
+ $toolbar->divider();
// Get the help information for the template item.
$lang = Factory::getLanguage();
@@ -143,6 +148,6 @@ protected function addToolbar()
$url = null;
}
- ToolbarHelper::help($help->key, false, $url);
+ $toolbar->help($help->key, false, $url);
}
}
diff --git a/administrator/components/com_templates/src/View/Styles/HtmlView.php b/administrator/components/com_templates/src/View/Styles/HtmlView.php
index d74d1909576b4..9b1ea20580a93 100644
--- a/administrator/components/com_templates/src/View/Styles/HtmlView.php
+++ b/administrator/components/com_templates/src/View/Styles/HtmlView.php
@@ -15,6 +15,7 @@
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
+use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
// phpcs:disable PSR1.Files.SideEffects
@@ -118,9 +119,12 @@ protected function addToolbar()
{
$canDo = ContentHelper::getActions('com_templates');
$clientId = (int) $this->get('State')->get('client_id');
+ $toolbar = Toolbar::getInstance();
// Add a shortcut to the templates list view.
- ToolbarHelper::link('index.php?option=com_templates&view=templates&client_id=' . $clientId, 'COM_TEMPLATES_MANAGER_TEMPLATES', 'icon-code thememanager');
+ $toolbar->linkButton('templates', 'COM_TEMPLATES_MANAGER_TEMPLATES')
+ ->url('index.php?option=com_templates&view=templates&client_id=' . $clientId)
+ ->icon('icon-code thememanager');
// Set the title.
if ($clientId === 1) {
@@ -130,25 +134,29 @@ protected function addToolbar()
}
if ($canDo->get('core.edit.state')) {
- ToolbarHelper::makeDefault('styles.setDefault', 'COM_TEMPLATES_TOOLBAR_SET_HOME');
- ToolbarHelper::divider();
+ $toolbar->makeDefault('styles.setDefault', 'COM_TEMPLATES_TOOLBAR_SET_HOME');
+ $toolbar->divider();
}
if ($canDo->get('core.create')) {
- ToolbarHelper::custom('styles.duplicate', 'copy', '', 'JTOOLBAR_DUPLICATE', true);
- ToolbarHelper::divider();
+ $toolbar->standardButton('duplicate', 'JTOOLBAR_DUPLICATE', 'styles.duplicate')
+ ->listCheck(true)
+ ->icon('icon-copy');
+ $toolbar->divider();
}
if ($canDo->get('core.delete')) {
- ToolbarHelper::deleteList('JGLOBAL_CONFIRM_DELETE', 'styles.delete', 'JTOOLBAR_DELETE');
- ToolbarHelper::divider();
+ $toolbar->delete('styles.delete')
+ ->message('JGLOBAL_CONFIRM_DELETE')
+ ->listCheck(true);
+ $toolbar->divider();
}
if ($canDo->get('core.admin') || $canDo->get('core.options')) {
- ToolbarHelper::preferences('com_templates');
- ToolbarHelper::divider();
+ $toolbar->preferences('com_templates');
+ $toolbar->divider();
}
- ToolbarHelper::help('Templates:_Styles');
+ $toolbar->help('Templates:_Styles');
}
}
diff --git a/administrator/components/com_templates/src/View/Template/HtmlView.php b/administrator/components/com_templates/src/View/Template/HtmlView.php
index 8127317f4a7fa..1d7b8ec783619 100644
--- a/administrator/components/com_templates/src/View/Template/HtmlView.php
+++ b/administrator/components/com_templates/src/View/Template/HtmlView.php
@@ -14,11 +14,11 @@
use Joomla\CMS\Factory;
use Joomla\CMS\Filter\InputFilter;
use Joomla\CMS\Form\Form;
-use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Object\CMSObject;
use Joomla\CMS\Plugin\PluginHelper;
+use Joomla\CMS\Toolbar\Button\DropdownButton;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Uri\Uri;
@@ -231,15 +231,13 @@ public function display($tpl = null)
*/
protected function addToolbar()
{
- $app = Factory::getApplication();
- $user = $this->getCurrentUser();
+ $app = Factory::getApplication();
+ $user = $this->getCurrentUser();
+ $toolbar = Toolbar::getInstance('toolbar');
$app->getInput()->set('hidemainmenu', true);
// User is global SuperUser
$isSuperUser = $user->authorise('core.admin');
-
- // Get the toolbar object instance
- $bar = Toolbar::getInstance('toolbar');
$explodeArray = explode('.', $this->fileName);
$ext = end($explodeArray);
@@ -249,15 +247,19 @@ protected function addToolbar()
if ($isSuperUser) {
// Add an Apply and save button
if ($this->type === 'file') {
- ToolbarHelper::apply('template.apply');
- ToolbarHelper::save('template.save');
+ $toolbar->apply('template.apply');
+ $toolbar->save('template.save');
} elseif ($this->type === 'image') {
// Add a Crop and Resize button
- ToolbarHelper::custom('template.cropImage', 'icon-crop', '', 'COM_TEMPLATES_BUTTON_CROP', false);
+ $toolbar->standardButton('crop', 'COM_TEMPLATES_BUTTON_CROP', 'template.cropImage')
+ ->listCheck(false)
+ ->icon('icon-crop');
ToolbarHelper::modal('resizeModal', 'icon-expand', 'COM_TEMPLATES_BUTTON_RESIZE');
} elseif ($this->type === 'archive') {
// Add an extract button
- ToolbarHelper::custom('template.extractArchive', 'chevron-down', '', 'COM_TEMPLATES_BUTTON_EXTRACT_ARCHIVE', false);
+ $toolbar->standardButton('extract', 'COM_TEMPLATES_BUTTON_EXTRACT_ARCHIVE', 'template.extractArchive')
+ ->listCheck(false)
+ ->icon('icon-chevron-down');
} elseif ($this->type === 'home') {
// Add a copy/child template button
if (isset($this->template->xmldata->inheritable) && (string) $this->template->xmldata->inheritable === '1') {
@@ -272,10 +274,9 @@ protected function addToolbar()
// Add a Template preview button
if ($this->type === 'home') {
$client = (int) $this->preview->client_id === 1 ? 'administrator/' : '';
- $bar->linkButton('preview')
- ->icon('icon-image')
- ->text('COM_TEMPLATES_BUTTON_PREVIEW')
+ $toolbar->linkButton('preview', 'COM_TEMPLATES_BUTTON_PREVIEW')
->url(Uri::root() . $client . 'index.php?tp=1&templateStyle=' . $this->preview->id)
+ ->icon('icon-image')
->attributes(['target' => '_new']);
}
@@ -297,8 +298,8 @@ protected function addToolbar()
}
if (count($this->updatedList) !== 0 && $this->pluginState && $this->type === 'home') {
- $dropdown = $bar->dropdownButton('override-group')
- ->text('COM_TEMPLATES_BUTTON_CHECK')
+ /** @var DropdownButton $dropdown */
+ $dropdown = $toolbar->dropdownButton('override-group', 'COM_TEMPLATES_BUTTON_CHECK')
->toggleSplit(false)
->icon('icon-ellipsis-h')
->buttonClass('btn btn-action')
@@ -322,13 +323,13 @@ protected function addToolbar()
}
if ($this->type === 'home') {
- ToolbarHelper::cancel('template.cancel', 'JTOOLBAR_CLOSE');
+ $toolbar->cancel('template.cancel');
} else {
- ToolbarHelper::cancel('template.close', 'COM_TEMPLATES_BUTTON_CLOSE_FILE');
+ $toolbar->cancel('template.close', 'COM_TEMPLATES_BUTTON_CLOSE_FILE');
}
- ToolbarHelper::divider();
- ToolbarHelper::help('Templates:_Customise');
+ $toolbar->divider();
+ $toolbar->help('Templates:_Customise');
}
/**
diff --git a/administrator/components/com_templates/src/View/Templates/HtmlView.php b/administrator/components/com_templates/src/View/Templates/HtmlView.php
index fa3bfbc641695..dc0b679ef28b2 100644
--- a/administrator/components/com_templates/src/View/Templates/HtmlView.php
+++ b/administrator/components/com_templates/src/View/Templates/HtmlView.php
@@ -16,6 +16,7 @@
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Plugin\PluginHelper;
+use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
// phpcs:disable PSR1.Files.SideEffects
@@ -135,9 +136,12 @@ protected function addToolbar()
{
$canDo = ContentHelper::getActions('com_templates');
$clientId = (int) $this->get('State')->get('client_id');
+ $toolbar = Toolbar::getInstance();
// Add a shortcut to the styles list view.
- ToolbarHelper::link('index.php?option=com_templates&view=styles&client_id=' . $clientId, 'COM_TEMPLATES_MANAGER_STYLES_BUTTON', 'brush thememanager');
+ $toolbar->linkButton('', 'COM_TEMPLATES_MANAGER_STYLES_BUTTON')
+ ->url('index.php?option=com_templates&view=styles&client_id=' . $clientId)
+ ->icon('icon-brush thememanager');
// Set the title.
if ($clientId === 1) {
@@ -147,10 +151,10 @@ protected function addToolbar()
}
if ($canDo->get('core.admin') || $canDo->get('core.options')) {
- ToolbarHelper::preferences('com_templates');
- ToolbarHelper::divider();
+ $toolbar->preferences('com_templates');
+ $toolbar->divider();
}
- ToolbarHelper::help('Templates:_Templates');
+ $toolbar->help('Templates:_Templates');
}
}
diff --git a/administrator/components/com_users/src/View/Debuggroup/HtmlView.php b/administrator/components/com_users/src/View/Debuggroup/HtmlView.php
index 93acf8844804d..0386e86f07abf 100644
--- a/administrator/components/com_users/src/View/Debuggroup/HtmlView.php
+++ b/administrator/components/com_users/src/View/Debuggroup/HtmlView.php
@@ -16,6 +16,7 @@
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Object\CMSObject;
+use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
// phpcs:disable PSR1.Files.SideEffects
@@ -123,16 +124,17 @@ public function display($tpl = null)
*/
protected function addToolbar()
{
- $canDo = ContentHelper::getActions('com_users');
+ $canDo = ContentHelper::getActions('com_users');
+ $toolbar = Toolbar::getInstance();
ToolbarHelper::title(Text::sprintf('COM_USERS_VIEW_DEBUG_GROUP_TITLE', $this->group->id, $this->escape($this->group->title)), 'users groups');
- ToolbarHelper::cancel('group.cancel', 'JTOOLBAR_CLOSE');
+ $toolbar->cancel('group.cancel');
if ($canDo->get('core.admin') || $canDo->get('core.options')) {
- ToolbarHelper::preferences('com_users');
- ToolbarHelper::divider();
+ $toolbar->preferences('com_users');
+ $toolbar->divider();
}
- ToolbarHelper::help('Permissions_for_Group');
+ $toolbar->help('Permissions_for_Group');
}
}
diff --git a/administrator/components/com_users/src/View/Debuguser/HtmlView.php b/administrator/components/com_users/src/View/Debuguser/HtmlView.php
index bf14e7ce9a2dc..8431876d75c61 100644
--- a/administrator/components/com_users/src/View/Debuguser/HtmlView.php
+++ b/administrator/components/com_users/src/View/Debuguser/HtmlView.php
@@ -16,6 +16,7 @@
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Object\CMSObject;
+use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\User\User;
@@ -123,16 +124,17 @@ public function display($tpl = null)
*/
protected function addToolbar()
{
- $canDo = ContentHelper::getActions('com_users');
+ $canDo = ContentHelper::getActions('com_users');
+ $toolbar = Toolbar::getInstance();
ToolbarHelper::title(Text::sprintf('COM_USERS_VIEW_DEBUG_USER_TITLE', $this->user->id, $this->escape($this->user->name)), 'users user');
- ToolbarHelper::cancel('user.cancel', 'JTOOLBAR_CLOSE');
+ $toolbar->cancel('user.cancel');
if ($canDo->get('core.admin') || $canDo->get('core.options')) {
- ToolbarHelper::preferences('com_users');
- ToolbarHelper::divider();
+ $toolbar->preferences('com_users');
+ $toolbar->divider();
}
- ToolbarHelper::help('Permissions_for_User');
+ $toolbar->help('Permissions_for_User');
}
}
diff --git a/administrator/components/com_users/src/View/Group/HtmlView.php b/administrator/components/com_users/src/View/Group/HtmlView.php
index e120eccb7b5c8..277ff9afcc150 100644
--- a/administrator/components/com_users/src/View/Group/HtmlView.php
+++ b/administrator/components/com_users/src/View/Group/HtmlView.php
@@ -16,6 +16,7 @@
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Object\CMSObject;
+use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
// phpcs:disable PSR1.Files.SideEffects
@@ -86,39 +87,41 @@ protected function addToolbar()
{
Factory::getApplication()->getInput()->set('hidemainmenu', true);
- $isNew = ($this->item->id == 0);
- $canDo = ContentHelper::getActions('com_users');
+ $isNew = ($this->item->id == 0);
+ $canDo = ContentHelper::getActions('com_users');
+ $toolbar = Toolbar::getInstance();
ToolbarHelper::title(Text::_($isNew ? 'COM_USERS_VIEW_NEW_GROUP_TITLE' : 'COM_USERS_VIEW_EDIT_GROUP_TITLE'), 'users-cog groups-add');
- $toolbarButtons = [];
-
if ($canDo->get('core.edit') || $canDo->get('core.create')) {
- ToolbarHelper::apply('group.apply');
- $toolbarButtons[] = ['save', 'group.save'];
- }
-
- if ($canDo->get('core.create')) {
- $toolbarButtons[] = ['save2new', 'group.save2new'];
- }
-
- // If an existing item, can save to a copy.
- if (!$isNew && $canDo->get('core.create')) {
- $toolbarButtons[] = ['save2copy', 'group.save2copy'];
+ $toolbar->apply('group.apply');
}
- ToolbarHelper::saveGroup(
- $toolbarButtons,
- 'btn-success'
+ $saveGroup = $toolbar->dropdownButton('save-group');
+ $saveGroup->configure(
+ function (Toolbar $childBar) use ($canDo, $isNew) {
+ if ($canDo->get('core.edit') || $canDo->get('core.create')) {
+ $childBar->save('group.save');
+ }
+
+ if ($canDo->get('core.create')) {
+ $childBar->save2new('group.save2new');
+ }
+
+ // If an existing item, can save to a copy.
+ if (!$isNew && $canDo->get('core.create')) {
+ $childBar->save2copy('group.save2copy');
+ }
+ }
);
if (empty($this->item->id)) {
- ToolbarHelper::cancel('group.cancel');
+ $toolbar->cancel('group.cancel', 'JTOOLBAR_CANCEL');
} else {
- ToolbarHelper::cancel('group.cancel', 'JTOOLBAR_CLOSE');
+ $toolbar->cancel('group.cancel');
}
- ToolbarHelper::divider();
- ToolbarHelper::help('Users:_New_or_Edit_Group');
+ $toolbar->divider();
+ $toolbar->help('Users:_New_or_Edit_Group');
}
}
diff --git a/administrator/components/com_users/src/View/Groups/HtmlView.php b/administrator/components/com_users/src/View/Groups/HtmlView.php
index cf7ce9c0a304e..f4afd7db68514 100644
--- a/administrator/components/com_users/src/View/Groups/HtmlView.php
+++ b/administrator/components/com_users/src/View/Groups/HtmlView.php
@@ -15,6 +15,7 @@
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Object\CMSObject;
+use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
// phpcs:disable PSR1.Files.SideEffects
@@ -102,24 +103,26 @@ public function display($tpl = null)
*/
protected function addToolbar()
{
- $canDo = ContentHelper::getActions('com_users');
+ $canDo = ContentHelper::getActions('com_users');
+ $toolbar = Toolbar::getInstance();
ToolbarHelper::title(Text::_('COM_USERS_VIEW_GROUPS_TITLE'), 'users-cog groups');
if ($canDo->get('core.create')) {
- ToolbarHelper::addNew('group.add');
+ $toolbar->addNew('group.add');
}
if ($canDo->get('core.delete')) {
- ToolbarHelper::deleteList('JGLOBAL_CONFIRM_DELETE', 'groups.delete', 'JTOOLBAR_DELETE');
- ToolbarHelper::divider();
+ $toolbar->delete('groups.delete')
+ ->message('JGLOBAL_CONFIRM_DELETE');
+ $toolbar->divider();
}
if ($canDo->get('core.admin') || $canDo->get('core.options')) {
- ToolbarHelper::preferences('com_users');
- ToolbarHelper::divider();
+ $toolbar->preferences('com_users');
+ $toolbar->divider();
}
- ToolbarHelper::help('Users:_Groups');
+ $toolbar->help('Users:_Groups');
}
}
diff --git a/administrator/components/com_users/src/View/Level/HtmlView.php b/administrator/components/com_users/src/View/Level/HtmlView.php
index 662fb02e3930f..e7f6d6502504d 100644
--- a/administrator/components/com_users/src/View/Level/HtmlView.php
+++ b/administrator/components/com_users/src/View/Level/HtmlView.php
@@ -16,6 +16,7 @@
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Object\CMSObject;
+use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
// phpcs:disable PSR1.Files.SideEffects
@@ -86,39 +87,41 @@ protected function addToolbar()
{
Factory::getApplication()->getInput()->set('hidemainmenu', true);
- $isNew = ($this->item->id == 0);
- $canDo = ContentHelper::getActions('com_users');
+ $isNew = ($this->item->id == 0);
+ $canDo = ContentHelper::getActions('com_users');
+ $toolbar = Toolbar::getInstance();
ToolbarHelper::title(Text::_($isNew ? 'COM_USERS_VIEW_NEW_LEVEL_TITLE' : 'COM_USERS_VIEW_EDIT_LEVEL_TITLE'), 'user-lock levels-add');
- $toolbarButtons = [];
-
if ($canDo->get('core.edit') || $canDo->get('core.create')) {
- ToolbarHelper::apply('level.apply');
- $toolbarButtons[] = ['save', 'level.save'];
- }
-
- if ($canDo->get('core.create')) {
- $toolbarButtons[] = ['save2new', 'level.save2new'];
- }
-
- // If an existing item, can save to a copy.
- if (!$isNew && $canDo->get('core.create')) {
- $toolbarButtons[] = ['save2copy', 'level.save2copy'];
+ $toolbar->apply('level.apply');
}
- ToolbarHelper::saveGroup(
- $toolbarButtons,
- 'btn-success'
+ $saveGroup = $toolbar->dropdownButton('save-group');
+ $saveGroup->configure(
+ function (Toolbar $childBar) use ($canDo, $isNew) {
+ if ($canDo->get('core.edit') || $canDo->get('core.create')) {
+ $childBar->save('level.save');
+ }
+
+ if ($canDo->get('core.create')) {
+ $childBar->save2new('level.save2new');
+ }
+
+ // If an existing item, can save to a copy.
+ if (!$isNew && $canDo->get('core.create')) {
+ $childBar->save2copy('level.save2copy');
+ }
+ }
);
if (empty($this->item->id)) {
- ToolbarHelper::cancel('level.cancel');
+ $toolbar->cancel('level.cancel', 'JTOOLBAR_CANCEL');
} else {
- ToolbarHelper::cancel('level.cancel', 'JTOOLBAR_CLOSE');
+ $toolbar->cancel('level.cancel');
}
- ToolbarHelper::divider();
- ToolbarHelper::help('Users:_Edit_Viewing_Access_Level');
+ $toolbar->divider();
+ $toolbar->help('Users:_Edit_Viewing_Access_Level');
}
}
diff --git a/administrator/components/com_users/src/View/Levels/HtmlView.php b/administrator/components/com_users/src/View/Levels/HtmlView.php
index 9707b4e592716..7eb3a1e94248f 100644
--- a/administrator/components/com_users/src/View/Levels/HtmlView.php
+++ b/administrator/components/com_users/src/View/Levels/HtmlView.php
@@ -15,6 +15,7 @@
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Object\CMSObject;
+use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
// phpcs:disable PSR1.Files.SideEffects
@@ -102,24 +103,26 @@ public function display($tpl = null)
*/
protected function addToolbar()
{
- $canDo = ContentHelper::getActions('com_users');
+ $canDo = ContentHelper::getActions('com_users');
+ $toolbar = Toolbar::getInstance();
ToolbarHelper::title(Text::_('COM_USERS_VIEW_LEVELS_TITLE'), 'user-lock levels');
if ($canDo->get('core.create')) {
- ToolbarHelper::addNew('level.add');
+ $toolbar->addNew('level.add');
}
if ($canDo->get('core.delete')) {
- ToolbarHelper::deleteList('JGLOBAL_CONFIRM_DELETE', 'level.delete', 'JTOOLBAR_DELETE');
- ToolbarHelper::divider();
+ $toolbar->delete('level.delete')
+ ->message('JGLOBAL_CONFIRM_DELETE');
+ $toolbar->divider();
}
if ($canDo->get('core.admin') || $canDo->get('core.options')) {
- ToolbarHelper::preferences('com_users');
- ToolbarHelper::divider();
+ $toolbar->preferences('com_users');
+ $toolbar->divider();
}
- ToolbarHelper::help('Users:_Viewing_Access_Levels');
+ $toolbar->help('Users:_Viewing_Access_Levels');
}
}
diff --git a/administrator/components/com_users/src/View/Mail/HtmlView.php b/administrator/components/com_users/src/View/Mail/HtmlView.php
index 213c82970dd85..30f198e7edcc7 100644
--- a/administrator/components/com_users/src/View/Mail/HtmlView.php
+++ b/administrator/components/com_users/src/View/Mail/HtmlView.php
@@ -76,10 +76,10 @@ protected function addToolbar()
->icon('icon-envelope')
->formValidation(true);
- ToolbarHelper::cancel('mail.cancel');
- ToolbarHelper::divider();
- ToolbarHelper::preferences('com_users');
- ToolbarHelper::divider();
- ToolbarHelper::help('Mass_Mail_Users');
+ $toolbar->cancel('mail.cancel', 'JTOOLBAR_CANCEL');
+ $toolbar->divider();
+ $toolbar->preferences('com_users');
+ $toolbar->divider();
+ $toolbar->help('Mass_Mail_Users');
}
}
diff --git a/administrator/components/com_users/src/View/Method/HtmlView.php b/administrator/components/com_users/src/View/Method/HtmlView.php
index 951ea5f21fbf4..9152b33e9d696 100644
--- a/administrator/components/com_users/src/View/Method/HtmlView.php
+++ b/administrator/components/com_users/src/View/Method/HtmlView.php
@@ -121,6 +121,7 @@ public function display($tpl = null): void
$this->record = $model->getRecord($this->user);
$this->title = $model->getPageTitle();
$this->isAdmin = $app->isClient('administrator');
+ $toolbar = Toolbar::getInstance();
// Backup codes are a special case, rendered with a special layout
if ($this->record->method == 'backupcodes') {
@@ -160,7 +161,7 @@ function ($x) {
$helpUrl = $this->renderOptions['help_url'];
if (!empty($helpUrl)) {
- ToolbarHelper::help('', false, $helpUrl);
+ $toolbar->help('', false, $helpUrl);
}
$this->title = '';
@@ -170,36 +171,30 @@ function ($x) {
$returnUrl = $returnUrl ?: Route::_('index.php?option=com_users&task=methods.display&user_id=' . $this->user->id);
if ($this->isAdmin && $this->getLayout() === 'edit') {
- $bar = Toolbar::getInstance();
$button = (new BasicButton('user-mfa-edit-save'))
->text($this->renderOptions['submit_text'])
->icon($this->renderOptions['submit_icon'])
->onclick('document.getElementById(\'user-mfa-edit-save\').click()');
if ($this->renderOptions['show_submit'] || $this->isEditExisting) {
- $bar->appendButton($button);
+ $toolbar->appendButton($button);
}
$button = (new LinkButton('user-mfa-edit-cancel'))
+ ->url($returnUrl)
->text('JCANCEL')
->buttonClass('btn btn-danger')
- ->icon('icon-cancel-2')
- ->url($returnUrl);
- $bar->appendButton($button);
+ ->icon('icon-cancel-2');
+ $toolbar->appendButton($button);
} elseif ($this->isAdmin && $this->getLayout() === 'backupcodes') {
- $bar = Toolbar::getInstance();
-
$arrow = Factory::getApplication()->getLanguage()->isRtl() ? 'arrow-right' : 'arrow-left';
$button = (new LinkButton('user-mfa-edit-cancel'))
+ ->url($returnUrl)
->text('JTOOLBAR_BACK')
- ->icon('icon-' . $arrow)
- ->url($returnUrl);
- $bar->appendButton($button);
+ ->icon('icon-' . $arrow);
+ $toolbar->appendButton($button);
$button = (new LinkButton('user-mfa-edit-cancel'))
- ->text('COM_USERS_MFA_BACKUPCODES_RESET')
- ->buttonClass('btn btn-danger')
- ->icon('icon-refresh')
->url(
Route::_(
sprintf(
@@ -209,8 +204,11 @@ function ($x) {
base64_encode($returnUrl)
)
)
- );
- $bar->appendButton($button);
+ )
+ ->text('COM_USERS_MFA_BACKUPCODES_RESET')
+ ->buttonClass('btn btn-danger')
+ ->icon('icon-refresh');
+ $toolbar->appendButton($button);
}
// Display the view
diff --git a/administrator/components/com_users/src/View/Methods/HtmlView.php b/administrator/components/com_users/src/View/Methods/HtmlView.php
index 3301f7ce01396..90e72b9903666 100644
--- a/administrator/components/com_users/src/View/Methods/HtmlView.php
+++ b/administrator/components/com_users/src/View/Methods/HtmlView.php
@@ -15,6 +15,7 @@
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Router\Route;
+use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\User\User;
use Joomla\Component\Users\Administrator\DataShape\MethodDescriptor;
@@ -178,7 +179,9 @@ public function display($tpl = null): void
ToolbarHelper::title(Text::_('COM_USERS_MFA_LIST_PAGE_HEAD'), 'users user-lock');
if (Factory::getApplication()->getIdentity()->authorise('core.manage', 'com_users')) {
- ToolbarHelper::back('JTOOLBAR_BACK', Route::_('index.php?option=com_users'));
+ $toolbar = Toolbar::getInstance();
+ $toolbar->link('back', 'JTOOLBAR_BACK')
+ ->url(Route::_('index.php?option=com_users'));
}
}
diff --git a/administrator/components/com_users/src/View/Note/HtmlView.php b/administrator/components/com_users/src/View/Note/HtmlView.php
index d58ff8657ebe9..c8303e2e67959 100644
--- a/administrator/components/com_users/src/View/Note/HtmlView.php
+++ b/administrator/components/com_users/src/View/Note/HtmlView.php
@@ -17,6 +17,7 @@
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Object\CMSObject;
+use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
// phpcs:disable PSR1.Files.SideEffects
@@ -97,45 +98,49 @@ protected function addToolbar()
$user = $this->getCurrentUser();
$isNew = ($this->item->id == 0);
$checkedOut = !(is_null($this->item->checked_out) || $this->item->checked_out == $user->get('id'));
+ $toolbar = Toolbar::getInstance();
// Since we don't track these assets at the item level, use the category id.
$canDo = ContentHelper::getActions('com_users', 'category', $this->item->catid);
ToolbarHelper::title(Text::_('COM_USERS_NOTES'), 'users user');
- $toolbarButtons = [];
-
// If not checked out, can save the item.
if (!$checkedOut && ($canDo->get('core.edit') || count($user->getAuthorisedCategories('com_users', 'core.create')))) {
- ToolbarHelper::apply('note.apply');
- $toolbarButtons[] = ['save', 'note.save'];
+ $toolbar->apply('note.apply');
}
- if (!$checkedOut && count($user->getAuthorisedCategories('com_users', 'core.create'))) {
- $toolbarButtons[] = ['save2new', 'note.save2new'];
- }
+ $saveGroup = $toolbar->dropdownButton('save-group');
- // If an existing item, can save to a copy.
- if (!$isNew && (count($user->getAuthorisedCategories('com_users', 'core.create')) > 0)) {
- $toolbarButtons[] = ['save2copy', 'note.save2copy'];
- }
+ $saveGroup->configure(
+ function (Toolbar $childBar) use ($checkedOut, $canDo, $user, $isNew) {
+ // If not checked out, can save the item.
+ if (!$checkedOut && ($canDo->get('core.edit') || count($user->getAuthorisedCategories('com_users', 'core.create')))) {
+ $childBar->save('note.save');
+ }
- ToolbarHelper::saveGroup(
- $toolbarButtons,
- 'btn-success'
+ if (!$checkedOut && count($user->getAuthorisedCategories('com_users', 'core.create'))) {
+ $childBar->save2new('note.save2new');
+ }
+
+ // If an existing item, can save to a copy.
+ if (!$isNew && (count($user->getAuthorisedCategories('com_users', 'core.create')) > 0)) {
+ $childBar->save2copy('note.save2copy');
+ }
+ }
);
if (empty($this->item->id)) {
- ToolbarHelper::cancel('note.cancel');
+ $toolbar->cancel('note.cancel', 'JTOOLBAR_CANCEL');
} else {
- ToolbarHelper::cancel('note.cancel', 'JTOOLBAR_CLOSE');
+ $toolbar->cancel('note.cancel');
if (ComponentHelper::isEnabled('com_contenthistory') && $this->state->params->get('save_history', 0) && $canDo->get('core.edit')) {
- ToolbarHelper::versions('com_users.note', $this->item->id);
+ $toolbar->versions('com_users.note', $this->item->id);
}
}
- ToolbarHelper::divider();
- ToolbarHelper::help('User_Notes:_New_or_Edit');
+ $toolbar->divider();
+ $toolbar->help('User_Notes:_New_or_Edit');
}
}
diff --git a/administrator/components/com_users/src/View/Notes/HtmlView.php b/administrator/components/com_users/src/View/Notes/HtmlView.php
index 19f7a1e98a414..559eb9f0e522a 100644
--- a/administrator/components/com_users/src/View/Notes/HtmlView.php
+++ b/administrator/components/com_users/src/View/Notes/HtmlView.php
@@ -15,6 +15,7 @@
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Object\CMSObject;
+use Joomla\CMS\Toolbar\Button\DropdownButton;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\User\User;
@@ -134,20 +135,18 @@ public function display($tpl = null)
*/
protected function addToolbar()
{
- $canDo = ContentHelper::getActions('com_users', 'category', $this->state->get('filter.category_id'));
+ $canDo = ContentHelper::getActions('com_users', 'category', $this->state->get('filter.category_id'));
+ $toolbar = Toolbar::getInstance();
ToolbarHelper::title(Text::_('COM_USERS_VIEW_NOTES_TITLE'), 'users user');
- // Get the toolbar object instance
- $toolbar = Toolbar::getInstance('toolbar');
-
if ($canDo->get('core.create')) {
$toolbar->addNew('note.add');
}
if (!$this->isEmptyState && ($canDo->get('core.edit.state') || $canDo->get('core.admin'))) {
- $dropdown = $toolbar->dropdownButton('status-group')
- ->text('JTOOLBAR_CHANGE_STATUS')
+ /** @var DropdownButton $dropdown */
+ $dropdown = $toolbar->dropdownButton('status-group', 'JTOOLBAR_CHANGE_STATUS')
->toggleSplit(false)
->icon('icon-ellipsis-h')
->buttonClass('btn btn-action')
@@ -168,8 +167,7 @@ protected function addToolbar()
}
if (!$this->isEmptyState && $this->state->get('filter.published') == -2 && $canDo->get('core.delete')) {
- $toolbar->delete('notes.delete')
- ->text('JTOOLBAR_EMPTY_TRASH')
+ $toolbar->delete('notes.delete', 'JTOOLBAR_EMPTY_TRASH')
->message('JGLOBAL_CONFIRM_DELETE')
->listCheck(true);
}
diff --git a/administrator/components/com_users/src/View/User/HtmlView.php b/administrator/components/com_users/src/View/User/HtmlView.php
index ea559e1f30fb2..26ec9e6d25c45 100644
--- a/administrator/components/com_users/src/View/User/HtmlView.php
+++ b/administrator/components/com_users/src/View/User/HtmlView.php
@@ -16,6 +16,7 @@
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Object\CMSObject;
+use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\User\User;
use Joomla\CMS\User\UserFactoryInterface;
@@ -150,6 +151,7 @@ protected function addToolbar()
$canDo = ContentHelper::getActions('com_users');
$isNew = ($this->item->id == 0);
$isProfile = $this->item->id == $user->id;
+ $toolbar = Toolbar::getInstance();
ToolbarHelper::title(
Text::_(
@@ -158,29 +160,31 @@ protected function addToolbar()
'user ' . ($isNew ? 'user-add' : ($isProfile ? 'user-profile' : 'user-edit'))
);
- $toolbarButtons = [];
-
if ($canDo->get('core.edit') || $canDo->get('core.create') || $isProfile) {
- ToolbarHelper::apply('user.apply');
- $toolbarButtons[] = ['save', 'user.save'];
+ $toolbar->apply('user.apply');
}
- if ($canDo->get('core.create') && $canDo->get('core.manage')) {
- $toolbarButtons[] = ['save2new', 'user.save2new'];
- }
+ $saveGroup = $toolbar->dropdownButton('save-group');
- ToolbarHelper::saveGroup(
- $toolbarButtons,
- 'btn-success'
+ $saveGroup->configure(
+ function (Toolbar $childBar) use ($canDo, $isProfile) {
+ if ($canDo->get('core.edit') || $canDo->get('core.create') || $isProfile) {
+ $childBar->save('user.save');
+ }
+
+ if ($canDo->get('core.create') && $canDo->get('core.manage')) {
+ $childBar->save2new('user.save2new');
+ }
+ }
);
if (empty($this->item->id)) {
- ToolbarHelper::cancel('user.cancel');
+ $toolbar->cancel('user.cancel', 'JTOOLBAR_CANCEL');
} else {
- ToolbarHelper::cancel('user.cancel', 'JTOOLBAR_CLOSE');
+ $toolbar->cancel('user.cancel');
}
- ToolbarHelper::divider();
- ToolbarHelper::help('Users:_Edit_Profile');
+ $toolbar->divider();
+ $toolbar->help('Users:_Edit_Profile');
}
}
diff --git a/administrator/components/com_users/src/View/Users/HtmlView.php b/administrator/components/com_users/src/View/Users/HtmlView.php
index a139d9d955cb1..6bd71f2a1a103 100644
--- a/administrator/components/com_users/src/View/Users/HtmlView.php
+++ b/administrator/components/com_users/src/View/Users/HtmlView.php
@@ -16,6 +16,7 @@
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Object\CMSObject;
+use Joomla\CMS\Toolbar\Button\DropdownButton;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\Database\DatabaseDriver;
@@ -138,8 +139,8 @@ protected function addToolbar()
}
if ($canDo->get('core.edit.state') || $canDo->get('core.admin')) {
- $dropdown = $toolbar->dropdownButton('status-group')
- ->text('JTOOLBAR_CHANGE_STATUS')
+ /** @var DropdownButton $dropdown */
+ $dropdown = $toolbar->dropdownButton('status-group', 'JTOOLBAR_CHANGE_STATUS')
->toggleSplit(false)
->icon('icon-ellipsis-h')
->buttonClass('btn btn-action')
@@ -149,9 +150,7 @@ protected function addToolbar()
$childBar->publish('users.activate', 'COM_USERS_TOOLBAR_ACTIVATE', true);
$childBar->unpublish('users.block', 'COM_USERS_TOOLBAR_BLOCK', true);
- $childBar->standardButton('unblock')
- ->text('COM_USERS_TOOLBAR_UNBLOCK')
- ->task('users.unblock')
+ $childBar->standardButton('unblock', 'COM_USERS_TOOLBAR_UNBLOCK', 'users.unblock')
->listCheck(true);
// Add a batch button
@@ -160,15 +159,13 @@ protected function addToolbar()
&& $user->authorise('core.edit', 'com_users')
&& $user->authorise('core.edit.state', 'com_users')
) {
- $childBar->popupButton('batch')
- ->text('JTOOLBAR_BATCH')
+ $childBar->popupButton('batch', 'JTOOLBAR_BATCH')
->selector('collapseModal')
->listCheck(true);
}
if ($canDo->get('core.delete')) {
- $childBar->delete('users.delete')
- ->text('JTOOLBAR_DELETE')
+ $childBar->delete('users.delete', 'JTOOLBAR_DELETE')
->message('JGLOBAL_CONFIRM_DELETE')
->listCheck(true);
}
diff --git a/administrator/components/com_workflow/src/View/Stage/HtmlView.php b/administrator/components/com_workflow/src/View/Stage/HtmlView.php
index ac8b7630b96ba..73062a3f76066 100644
--- a/administrator/components/com_workflow/src/View/Stage/HtmlView.php
+++ b/administrator/components/com_workflow/src/View/Stage/HtmlView.php
@@ -14,6 +14,7 @@
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
+use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\Component\Workflow\Administrator\Helper\StageHelper;
@@ -121,54 +122,54 @@ protected function addToolbar()
$user = $this->getCurrentUser();
$userId = $user->id;
$isNew = empty($this->item->id);
+ $toolbar = Toolbar::getInstance();
$canDo = StageHelper::getActions($this->extension, 'stage', $this->item->id);
ToolbarHelper::title(empty($this->item->id) ? Text::_('COM_WORKFLOW_STAGE_ADD') : Text::_('COM_WORKFLOW_STAGE_EDIT'), 'address');
- $toolbarButtons = [];
-
if ($isNew) {
// For new records, check the create permission.
if ($canDo->get('core.create')) {
- ToolbarHelper::apply('stage.apply');
- $toolbarButtons = [['save', 'stage.save'], ['save2new', 'stage.save2new']];
+ $toolbar->apply('stage.apply');
}
- ToolbarHelper::saveGroup(
- $toolbarButtons,
- 'btn-success'
+ $saveGroup = $toolbar->dropdownButton('save-group');
+ $saveGroup->configure(
+ function (Toolbar $childBar) use ($canDo) {
+ // For new records, check the create permission.
+ if ($canDo->get('core.create')) {
+ $childBar->save('stage.save');
+ $childBar->save2new('stage.save2new');
+ }
+ }
);
- ToolbarHelper::cancel(
- 'stage.cancel'
- );
+ $toolbar->cancel('stage.cancel', 'JTOOLBAR_CANCEL');
} else {
// Since it's an existing record, check the edit permission, or fall back to edit own if the owner.
$itemEditable = $canDo->get('core.edit') || ($canDo->get('core.edit.own') && $this->item->created_by == $userId);
if ($itemEditable) {
- ToolbarHelper::apply('stage.apply');
- $toolbarButtons = [['save', 'stage.save']];
-
- // We can save this record, but check the create permission to see if we can return to make a new one.
- if ($canDo->get('core.create')) {
- $toolbarButtons[] = ['save2new', 'stage.save2new'];
- $toolbarButtons[] = ['save2copy', 'stage.save2copy'];
- }
+ $toolbar->apply('stage.apply');
+
+ $saveGroup = $toolbar->dropdownButton('save-group');
+ $saveGroup->configure(
+ function (Toolbar $childBar) use ($canDo) {
+ $childBar->save('stage.save');
+
+ // We can save this record, but check the create permission to see if we can return to make a new one.
+ if ($canDo->get('core.create')) {
+ $childBar->save2new('stage.save2new');
+ $childBar->save2copy('stage.save2copy');
+ }
+ }
+ );
}
- ToolbarHelper::saveGroup(
- $toolbarButtons,
- 'btn-success'
- );
-
- ToolbarHelper::cancel(
- 'stage.cancel',
- 'JTOOLBAR_CLOSE'
- );
+ $toolbar->cancel('stage.cancel');
}
- ToolbarHelper::divider();
+ $toolbar->divider();
}
}
diff --git a/administrator/components/com_workflow/src/View/Stages/HtmlView.php b/administrator/components/com_workflow/src/View/Stages/HtmlView.php
index fadf6fa565e43..9970405a2ac41 100644
--- a/administrator/components/com_workflow/src/View/Stages/HtmlView.php
+++ b/administrator/components/com_workflow/src/View/Stages/HtmlView.php
@@ -16,6 +16,7 @@
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Router\Route;
+use Joomla\CMS\Toolbar\Button\DropdownButton;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
@@ -169,19 +170,19 @@ protected function addToolbar()
$arrow = Factory::getLanguage()->isRtl() ? 'arrow-right' : 'arrow-left';
- ToolbarHelper::link(
- Route::_('index.php?option=com_workflow&view=workflows&extension=' . $this->escape($this->workflow->extension)),
+ $toolbar->link(
'JTOOLBAR_BACK',
- $arrow
- );
+ Route::_('index.php?option=com_workflow&view=workflows&extension=' . $this->escape($this->workflow->extension))
+ )
+ ->icon('icon-' . $arrow);
if ($canDo->get('core.create')) {
$toolbar->addNew('stage.add');
}
if ($canDo->get('core.edit.state') || $user->authorise('core.admin')) {
- $dropdown = $toolbar->dropdownButton('status-group')
- ->text('JTOOLBAR_CHANGE_STATUS')
+ /** @var DropdownButton $dropdown */
+ $dropdown = $toolbar->dropdownButton('status-group', 'JTOOLBAR_CHANGE_STATUS')
->toggleSplit(false)
->icon('icon-ellipsis-h')
->buttonClass('btn btn-action')
@@ -203,8 +204,7 @@ protected function addToolbar()
}
if ($this->state->get('filter.published') === '-2' && $canDo->get('core.delete')) {
- $toolbar->delete('stages.delete')
- ->text('JTOOLBAR_EMPTY_TRASH')
+ $toolbar->delete('stages.delete', 'JTOOLBAR_EMPTY_TRASH')
->message('JGLOBAL_CONFIRM_DELETE')
->listCheck(true);
}
diff --git a/administrator/components/com_workflow/src/View/Transition/HtmlView.php b/administrator/components/com_workflow/src/View/Transition/HtmlView.php
index 7e04c236b5854..ffca18ebd0ca4 100644
--- a/administrator/components/com_workflow/src/View/Transition/HtmlView.php
+++ b/administrator/components/com_workflow/src/View/Transition/HtmlView.php
@@ -14,6 +14,7 @@
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
+use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\Component\Workflow\Administrator\Helper\StageHelper;
@@ -151,60 +152,56 @@ protected function addToolbar()
$user = $this->getCurrentUser();
$userId = $user->id;
$isNew = empty($this->item->id);
-
- $canDo = StageHelper::getActions($this->extension, 'transition', $this->item->id);
+ $toolbar = Toolbar::getInstance();
+ $canDo = StageHelper::getActions($this->extension, 'transition', $this->item->id);
+ $canCreate = $canDo->get('core.create');
ToolbarHelper::title(empty($this->item->id) ? Text::_('COM_WORKFLOW_TRANSITION_ADD') : Text::_('COM_WORKFLOW_TRANSITION_EDIT'), 'address');
- $toolbarButtons = [];
-
- $canCreate = $canDo->get('core.create');
-
if ($isNew) {
// For new records, check the create permission.
if ($canCreate) {
- ToolbarHelper::apply('transition.apply');
- $toolbarButtons = [['save', 'transition.save'], ['save2new', 'transition.save2new']];
- }
+ $toolbar->apply('transition.apply');
- ToolbarHelper::saveGroup(
- $toolbarButtons,
- 'btn-success'
- );
+ $saveGroup = $toolbar->dropdownButton('save-group');
- ToolbarHelper::cancel(
- 'transition.cancel'
- );
+ $saveGroup->configure(
+ function (Toolbar $childBar) {
+ // For new records, check the create permission.
+ $childBar->save('transition.save');
+ $childBar->save2new('transition.save2new');
+ }
+ );
+ }
+
+ $toolbar->cancel('transition.cancel', 'JTOOLBAR_CANCEL');
} else {
// Since it's an existing record, check the edit permission, or fall back to edit own if the owner.
$itemEditable = $canDo->get('core.edit') || ($canDo->get('core.edit.own') && $this->item->created_by == $userId);
if ($itemEditable) {
- ToolbarHelper::apply('transition.apply');
- $toolbarButtons[] = ['save', 'transition.save'];
-
- // We can save this record, but check the create permission to see if we can return to make a new one.
- if ($canCreate) {
- $toolbarButtons[] = ['save2new', 'transition.save2new'];
- $toolbarButtons[] = ['save2copy', 'transition.save2copy'];
- }
- }
-
- if (count($toolbarButtons) > 1) {
- ToolbarHelper::saveGroup(
- $toolbarButtons,
- 'btn-success'
- );
+ $toolbar->apply('transition.apply');
} else {
- ToolbarHelper::save('transition.save');
+ $toolbar->save('transition.save');
}
- ToolbarHelper::cancel(
- 'transition.cancel',
- 'JTOOLBAR_CLOSE'
+ $saveGroup = $toolbar->dropdownButton('save-group');
+
+ $saveGroup->configure(
+ function (Toolbar $childBar) use ($canCreate) {
+ $childBar->save('transition.save');
+
+ // We can save this record, but check the create permission to see if we can return to make a new one.
+ if ($canCreate) {
+ $childBar->save2new('transition.save2new');
+ $childBar->save2copy('transition.save2copy');
+ }
+ }
);
+
+ $toolbar->cancel('transition.cancel');
}
- ToolbarHelper::divider();
+ $toolbar->divider();
}
}
diff --git a/administrator/components/com_workflow/src/View/Transitions/HtmlView.php b/administrator/components/com_workflow/src/View/Transitions/HtmlView.php
index 96b9af27911d1..c9367bf23cca6 100644
--- a/administrator/components/com_workflow/src/View/Transitions/HtmlView.php
+++ b/administrator/components/com_workflow/src/View/Transitions/HtmlView.php
@@ -16,6 +16,7 @@
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Router\Route;
+use Joomla\CMS\Toolbar\Button\DropdownButton;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
@@ -159,29 +160,27 @@ public function display($tpl = null)
*/
protected function addToolbar()
{
- $canDo = ContentHelper::getActions($this->extension, 'workflow', $this->workflowID);
-
- $user = $this->getCurrentUser();
-
- $toolbar = Toolbar::getInstance('toolbar');
+ $canDo = ContentHelper::getActions($this->extension, 'workflow', $this->workflowID);
+ $user = $this->getCurrentUser();
+ $toolbar = Toolbar::getInstance();
ToolbarHelper::title(Text::sprintf('COM_WORKFLOW_TRANSITIONS_LIST', Text::_($this->state->get('active_workflow'))), 'address contact');
$arrow = Factory::getLanguage()->isRtl() ? 'arrow-right' : 'arrow-left';
- ToolbarHelper::link(
- Route::_('index.php?option=com_workflow&view=workflows&extension=' . $this->escape($this->workflow->extension)),
+ $toolbar->link(
'JTOOLBAR_BACK',
- $arrow
- );
+ Route::_('index.php?option=com_workflow&view=workflows&extension=' . $this->escape($this->workflow->extension)),
+ )
+ ->icon('icon-' . $arrow);
if ($canDo->get('core.create')) {
$toolbar->addNew('transition.add');
}
if ($canDo->get('core.edit.state') || $user->authorise('core.admin')) {
- $dropdown = $toolbar->dropdownButton('status-group')
- ->text('JTOOLBAR_CHANGE_STATUS')
+ /** @var DropdownButton $dropdown */
+ $dropdown = $toolbar->dropdownButton('status-group', 'JTOOLBAR_CHANGE_STATUS')
->toggleSplit(false)
->icon('icon-ellipsis-h')
->buttonClass('btn btn-action')
@@ -202,8 +201,7 @@ protected function addToolbar()
}
if ($this->state->get('filter.published') === '-2' && $canDo->get('core.delete')) {
- $toolbar->delete('transitions.delete')
- ->text('JTOOLBAR_EMPTY_TRASH')
+ $toolbar->delete('transitions.delete', 'JTOOLBAR_EMPTY_TRASH')
->message('JGLOBAL_CONFIRM_DELETE')
->listCheck(true);
}
diff --git a/administrator/components/com_workflow/src/View/Workflow/HtmlView.php b/administrator/components/com_workflow/src/View/Workflow/HtmlView.php
index 07cd04279aad9..5d3dc642543cf 100644
--- a/administrator/components/com_workflow/src/View/Workflow/HtmlView.php
+++ b/administrator/components/com_workflow/src/View/Workflow/HtmlView.php
@@ -14,6 +14,7 @@
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
+use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\Component\Workflow\Administrator\Helper\WorkflowHelper;
@@ -126,52 +127,50 @@ protected function addToolbar()
$user = $this->getCurrentUser();
$userId = $user->id;
$isNew = empty($this->item->id);
-
- $canDo = WorkflowHelper::getActions($this->extension, 'workflow', $this->item->id);
+ $toolbar = Toolbar::getInstance();
+ $canDo = WorkflowHelper::getActions($this->extension, 'workflow', $this->item->id);
ToolbarHelper::title(empty($this->item->id) ? Text::_('COM_WORKFLOW_WORKFLOWS_ADD') : Text::_('COM_WORKFLOW_WORKFLOWS_EDIT'), 'address');
- $toolbarButtons = [];
-
if ($isNew) {
// For new records, check the create permission.
if ($canDo->get('core.create')) {
- ToolbarHelper::apply('workflow.apply');
- $toolbarButtons = [['save', 'workflow.save'], ['save2new', 'workflow.save2new']];
- }
+ $toolbar->apply('workflow.apply');
- ToolbarHelper::saveGroup(
- $toolbarButtons,
- 'btn-success'
- );
+ $saveGroup = $toolbar->dropdownButton('save-group');
+
+ $saveGroup->configure(
+ function (Toolbar $childBar) {
+ $childBar->save('workflow.save');
+ $childBar->save2new('workflow.save2new');
+ }
+ );
+ }
- ToolbarHelper::cancel(
- 'workflow.cancel'
- );
+ $toolbar->cancel('workflow.cancel', 'JTOOLBAR_CANCEL');
} else {
// Since it's an existing record, check the edit permission, or fall back to edit own if the owner.
$itemEditable = $canDo->get('core.edit') || ($canDo->get('core.edit.own') && $this->item->created_by == $userId);
if ($itemEditable) {
- ToolbarHelper::apply('workflow.apply');
- $toolbarButtons = [['save', 'workflow.save']];
-
- // We can save this record, but check the create permission to see if we can return to make a new one.
- if ($canDo->get('core.create')) {
- $toolbarButtons[] = ['save2new', 'workflow.save2new'];
- $toolbarButtons[] = ['save2copy', 'workflow.save2copy'];
- }
- }
+ $toolbar->apply('workflow.apply');
+
+ $saveGroup = $toolbar->dropdownButton('save-group');
- ToolbarHelper::saveGroup(
- $toolbarButtons,
- 'btn-success'
- );
+ $saveGroup->configure(
+ function (Toolbar $childBar) use ($canDo) {
+ $childBar->save('workflow.save');
+
+ // We can save this record, but check the create permission to see if we can return to make a new one.
+ if ($canDo->get('core.create')) {
+ $childBar->save2new('workflow.save2new');
+ $childBar->save2copy('workflow.save2copy');
+ }
+ }
+ );
+ }
- ToolbarHelper::cancel(
- 'workflow.cancel',
- 'JTOOLBAR_CLOSE'
- );
+ $toolbar->cancel('workflow.cancel');
}
}
}
diff --git a/administrator/components/com_workflow/src/View/Workflows/HtmlView.php b/administrator/components/com_workflow/src/View/Workflows/HtmlView.php
index b3fd40614c4a1..71352a9b31846 100644
--- a/administrator/components/com_workflow/src/View/Workflows/HtmlView.php
+++ b/administrator/components/com_workflow/src/View/Workflows/HtmlView.php
@@ -15,6 +15,7 @@
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
+use Joomla\CMS\Toolbar\Button\DropdownButton;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
@@ -139,12 +140,9 @@ public function display($tpl = null)
*/
protected function addToolbar()
{
- $canDo = ContentHelper::getActions($this->extension, $this->section);
-
- $user = Factory::getApplication()->getIdentity();
-
- // Get the toolbar object instance
- $toolbar = Toolbar::getInstance('toolbar');
+ $canDo = ContentHelper::getActions($this->extension, $this->section);
+ $user = Factory::getApplication()->getIdentity();
+ $toolbar = Toolbar::getInstance();
ToolbarHelper::title(Text::_('COM_WORKFLOW_WORKFLOWS_LIST'), 'file-alt contact');
@@ -153,8 +151,8 @@ protected function addToolbar()
}
if ($canDo->get('core.edit.state') || $user->authorise('core.admin')) {
- $dropdown = $toolbar->dropdownButton('status-group')
- ->text('JTOOLBAR_CHANGE_STATUS')
+ /** @var DropdownButton $dropdown */
+ $dropdown = $toolbar->dropdownButton('status-group', 'JTOOLBAR_CHANGE_STATUS')
->toggleSplit(false)
->icon('icon-ellipsis-h')
->buttonClass('btn btn-action')
@@ -176,8 +174,7 @@ protected function addToolbar()
}
if ($this->state->get('filter.published') === '-2' && $canDo->get('core.delete')) {
- $toolbar->delete('workflows.delete')
- ->text('JTOOLBAR_EMPTY_TRASH')
+ $toolbar->delete('workflows.delete', 'JTOOLBAR_EMPTY_TRASH')
->message('JGLOBAL_CONFIRM_DELETE')
->listCheck(true);
}
diff --git a/libraries/src/Toolbar/CoreButtonsTrait.php b/libraries/src/Toolbar/CoreButtonsTrait.php
index 2e96e5ec7da16..db0255225317c 100644
--- a/libraries/src/Toolbar/CoreButtonsTrait.php
+++ b/libraries/src/Toolbar/CoreButtonsTrait.php
@@ -15,6 +15,7 @@
use Joomla\CMS\Toolbar\Button\ConfirmButton;
use Joomla\CMS\Toolbar\Button\CustomButton;
use Joomla\CMS\Toolbar\Button\HelpButton;
+use Joomla\CMS\Toolbar\Button\InlinehelpButton;
use Joomla\CMS\Toolbar\Button\LinkButton;
use Joomla\CMS\Toolbar\Button\PopupButton;
use Joomla\CMS\Toolbar\Button\SeparatorButton;
@@ -125,6 +126,22 @@ public function help($ref, $useComponent = false, $url = null, $component = null
->component($component);
}
+ /**
+ * Writes a help button for a given option (opens a popup window).
+ *
+ * @param string $class The class used by the inline help items.
+ *
+ * @return InlinehelpButton
+ *
+ * @since __DEPLOY_VERSION__
+ */
+ public function inlinehelp(string $class = 'hide-aware-inline-help'): InlinehelpButton
+ {
+ return $this->inlinehelpButton('inlinehelp')
+ ->targetclass($class)
+ ->icon('fa fa-question-circle');
+ }
+
/**
* Writes a cancel button that will go back to the previous page without doing
* any other operation.
@@ -187,8 +204,7 @@ public function mediaManager(string $directory, string $text = 'JTOOLBAR_UPLOAD'
*/
public function makeDefault(string $task, string $text = 'JTOOLBAR_DEFAULT'): StandardButton
{
- return $this->standardButton('default', $text)
- ->task($task);
+ return $this->standardButton('default', $text, $task);
}
/**
@@ -203,8 +219,7 @@ public function makeDefault(string $task, string $text = 'JTOOLBAR_DEFAULT'): St
*/
public function assign(string $task, string $text = 'JTOOLBAR_ASSIGN'): StandardButton
{
- return $this->standardButton('assign', $text)
- ->task($task);
+ return $this->standardButton('assign', $text, $task);
}
/**
@@ -219,8 +234,7 @@ public function assign(string $task, string $text = 'JTOOLBAR_ASSIGN'): Standard
*/
public function addNew(string $task, string $text = 'JTOOLBAR_NEW'): StandardButton
{
- return $this->standardButton('new', $text)
- ->task($task);
+ return $this->standardButton('new', $text, $task);
}
/**
@@ -235,8 +249,7 @@ public function addNew(string $task, string $text = 'JTOOLBAR_NEW'): StandardBut
*/
public function publish(string $task, string $text = 'JTOOLBAR_PUBLISH'): StandardButton
{
- return $this->standardButton('publish', $text)
- ->task($task);
+ return $this->standardButton('publish', $text, $task);
}
/**
@@ -251,8 +264,7 @@ public function publish(string $task, string $text = 'JTOOLBAR_PUBLISH'): Standa
*/
public function unpublish(string $task, string $text = 'JTOOLBAR_UNPUBLISH'): StandardButton
{
- return $this->standardButton('unpublish', $text)
- ->task($task);
+ return $this->standardButton('unpublish', $text, $task);
}
/**
@@ -267,8 +279,7 @@ public function unpublish(string $task, string $text = 'JTOOLBAR_UNPUBLISH'): St
*/
public function archive(string $task, string $text = 'JTOOLBAR_ARCHIVE'): StandardButton
{
- return $this->standardButton('archive', $text)
- ->task($task);
+ return $this->standardButton('archive', $text, $task);
}
/**
@@ -283,8 +294,7 @@ public function archive(string $task, string $text = 'JTOOLBAR_ARCHIVE'): Standa
*/
public function unarchive(string $task, string $text = 'JTOOLBAR_UNARCHIVE'): StandardButton
{
- return $this->standardButton('unarchive', $text)
- ->task($task);
+ return $this->standardButton('unarchive', $text, $task);
}
/**
@@ -299,8 +309,7 @@ public function unarchive(string $task, string $text = 'JTOOLBAR_UNARCHIVE'): St
*/
public function edit(string $task, string $text = 'JTOOLBAR_EDIT'): StandardButton
{
- return $this->standardButton('edit', $text)
- ->task($task);
+ return $this->standardButton('edit', $text, $task);
}
/**
@@ -315,8 +324,7 @@ public function edit(string $task, string $text = 'JTOOLBAR_EDIT'): StandardButt
*/
public function editHtml(string $task, string $text = 'JTOOLBAR_EDIT_HTML'): StandardButton
{
- return $this->standardButton('edithtml', $text)
- ->task($task);
+ return $this->standardButton('edithtml', $text, $task);
}
/**
@@ -331,8 +339,7 @@ public function editHtml(string $task, string $text = 'JTOOLBAR_EDIT_HTML'): Sta
*/
public function editCss(string $task, string $text = 'JTOOLBAR_EDIT_CSS'): StandardButton
{
- return $this->standardButton('editcss', $text)
- ->task($task);
+ return $this->standardButton('editcss', $text, $task);
}
/**
@@ -347,8 +354,7 @@ public function editCss(string $task, string $text = 'JTOOLBAR_EDIT_CSS'): Stand
*/
public function delete(string $task, string $text = 'JTOOLBAR_DELETE'): ConfirmButton
{
- return $this->confirmButton('delete', $text)
- ->task($task);
+ return $this->confirmButton('delete', $text, $task);
}
/**
@@ -363,8 +369,7 @@ public function delete(string $task, string $text = 'JTOOLBAR_DELETE'): ConfirmB
*/
public function trash(string $task, string $text = 'JTOOLBAR_TRASH'): StandardButton
{
- return $this->standardButton('trash', $text)
- ->task($task);
+ return $this->standardButton('trash', $text, $task);
}
/**
@@ -380,8 +385,7 @@ public function trash(string $task, string $text = 'JTOOLBAR_TRASH'): StandardBu
*/
public function apply(string $task, string $text = 'JTOOLBAR_APPLY'): StandardButton
{
- return $this->standardButton('apply', $text)
- ->task($task)
+ return $this->standardButton('apply', $text, $task)
->formValidation(true);
}
@@ -398,8 +402,7 @@ public function apply(string $task, string $text = 'JTOOLBAR_APPLY'): StandardBu
*/
public function save(string $task, string $text = 'JTOOLBAR_SAVE'): StandardButton
{
- return $this->standardButton('save', $text)
- ->task($task)
+ return $this->standardButton('save', $text, $task)
->formValidation(true);
}
@@ -416,8 +419,7 @@ public function save(string $task, string $text = 'JTOOLBAR_SAVE'): StandardButt
*/
public function save2new(string $task, string $text = 'JTOOLBAR_SAVE_AND_NEW'): StandardButton
{
- return $this->standardButton('save-new', $text)
- ->task($task)
+ return $this->standardButton('save-new', $text, $task)
->formValidation(true);
}
@@ -435,8 +437,7 @@ public function save2new(string $task, string $text = 'JTOOLBAR_SAVE_AND_NEW'):
*/
public function save2copy(string $task, string $text = 'JTOOLBAR_SAVE_AS_COPY'): StandardButton
{
- return $this->standardButton('save-copy', $text)
- ->task($task)
+ return $this->standardButton('save-copy', $text, $task)
->formValidation(true);
}
@@ -452,8 +453,8 @@ public function save2copy(string $task, string $text = 'JTOOLBAR_SAVE_AS_COPY'):
*/
public function checkin(string $task, string $text = 'JTOOLBAR_CHECKIN'): StandardButton
{
- return $this->standardButton('checkin', $text)
- ->task($task);
+ return $this->standardButton('checkin', $text, $task)
+ ->listCheck(true);
}
/**
@@ -468,8 +469,7 @@ public function checkin(string $task, string $text = 'JTOOLBAR_CHECKIN'): Standa
*/
public function cancel(string $task, string $text = 'JTOOLBAR_CLOSE'): StandardButton
{
- return $this->standardButton('cancel', $text)
- ->task($task);
+ return $this->standardButton('cancel', $text, $task);
}
/**
diff --git a/libraries/src/Toolbar/ToolbarHelper.php b/libraries/src/Toolbar/ToolbarHelper.php
index 5e93045499370..841a434dcb178 100644
--- a/libraries/src/Toolbar/ToolbarHelper.php
+++ b/libraries/src/Toolbar/ToolbarHelper.php
@@ -191,11 +191,7 @@ public static function help($ref, $com = false, $override = null, $component = n
public static function inlinehelp(string $class = "hide-aware-inline-help")
{
$bar = Toolbar::getInstance('toolbar');
-
- // Add a help button.
- $bar->inlinehelpButton('inlinehelp')
- ->targetclass($class)
- ->icon('fa fa-question-circle');
+ $bar->inlinehelp($class);
}
/**