[BUG]: missing toolbar in site view #1116
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What Happened?
In the site view (edit view) is missing the toolbar, and instead we get an error 'Call to undefined method Joomla\Database\Mysqli\MysqliDriver::toSql()'.
A possible fix is the following:
in the HtmlView.php of the Site View (View\Entity\HtmlView.php) in the display function, add
$this->toolbar = Toolbar::getInstance('toolbar');
after
Steps to reproduce the Bug
Create a component with a site view and try to open a single view
Which Joomla version are you compiling in?
3.10.12
Which PHP version are you compiling in?
8.2.2
Which Joomla versions are you targeting?
4.4.4
Which PHP version are you targeting?
8.2.4
Which Web server is JCB running on?
Apache 2.4
Which Relational Database is JCB running on?
MySql 8.0
Which OS is JCB running on?
Windows 11
Which JCB version are you using?
3.2.1-rc3
Where in JCB did this issue occur?
Compilation of a component, Site View(admin_view)
On which browsers did you encounter the issue?
Firefox, Chrome
Additional Comments
No response
Hello, this is apparently an old bug, I'm not opening a new one to avoid redundancy.
Using Joomla 5.3.1 and JCB 5.1.1 latest stable release at this time, on PHP 8.2 (ubuntu using Octojoom).
I see that in this release the add toolbar method was uptated to:
$this->toolbar ??= Factory::getContainer()->get(ToolbarFactoryInterface::class)->createToolbar('toolbar');
which works on the admin but not in the site edit view.
Online search throws this article: https://docs.joomla.org/J3.x:Developing_an_MVC_Component/Upgrading_to_Joomla4#Deprecated_getInstance_Methods
which says that there is a problem when using the new approach for the toolbar.
Manually changing it back to:
$this->toolbar ??= Toolbar::getInstance();
seems to solve the issue for the time being.Is there a way to have JCB diferentiate between methods when on admin or on site vice is compiled? or is there any other fix for this issue?
Okay... change this file on your system as it is used to build the site
HtmlView
class./admin/compiler/joomla_4/SITE_ADMIN_VIEW_HTML.php
@Lemuel we need to test the on the demo component front-end, so we can confirm this.
thank you @Llewellyn , I modified the line 182 in that file to:
$this->toolbar ??= Joomla___47ee1f2b_9902_4f26_a856_04930ac9ddc3___Power::getInstance();
\And the toolbar displays correctly in the site edit view.