[BUG]: missing toolbar in site view #1116

Open
opened 2024-05-02 14:53:41 +00:00 by Polmock · 3 comments

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

// Set the toolbar
$this->addToolBar();

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

### 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 ``` // Set the toolbar $this->addToolBar(); ``` ### 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_
Polmock added the
Bug
label 2024-05-02 14:53:41 +00:00
Member

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?

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](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?
Owner

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.

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](https://git.vdm.dev/joomla/Component-Builder/src/commit/e097540a7d8867b5665b08510e91f80fdff085c3/admin/compiler/joomla_4/SITE_ADMIN_VIEW_HTML.php#L182) @Lemuel we need to test the on the demo component front-end, so we can confirm this.
Member

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.

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.
Sign in to join this conversation.
3 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: joomla/Component-Builder#1116
No description provided.