joomla-cms icon indicating copy to clipboard operation
joomla-cms copied to clipboard

[5.2] Remove Toolbar::getInstance() from views

Open Hackwar opened this issue 1 year ago • 2 comments

Summary of Changes

Toolbar::getInstance() has been deprecated for quite some time now, but the alternative wasn't really clear yet. This PR replaces all occurences with $this->getDocument()->getToolbar() instead. This leaves the Toolbar::getInstance() in the ToolbarHelper class.

Testing Instructions

Codereview

Link to documentations

Please select:

  • [ ] Documentation link for docs.joomla.org:

  • [X] No documentation changes for docs.joomla.org needed

  • [ ] Pull Request link for manual.joomla.org:

  • [X] No documentation changes for manual.joomla.org needed

Hackwar avatar May 22 '24 11:05 Hackwar

What the issue @brianteeman ?

HLeithner avatar May 22 '24 13:05 HLeithner

What the issue @brianteeman ?

  1. obvious errors due to blindly search/replace (picked up by drone)
  2. stating that no documentation is required.

brianteeman avatar May 22 '24 16:05 brianteeman

I checked all files but can't find a search replace issue. if you mean the conversation from Toolbar::getInstance('toolbar'); to $this->getDocument()->getToolbar(); without the parameter toolbar this is ok because the default toolbar is toolbar.

on the side I checked some file for missing removal of the use statement for the toolbar which can be removed if not used, as it has been done for some view.

HLeithner avatar Jul 15 '24 09:07 HLeithner

Sorry no idea as its been 10 weeks but based on my comment it must have been something shown up in drone so maybe retrigger drone and see

brianteeman avatar Jul 15 '24 09:07 brianteeman

@Hackwar Could you please remove the unused use Joomla\CMS\Toolbar\Toolbar; statements?

pe7er avatar Jul 16 '24 08:07 pe7er

Done

Hackwar avatar Jul 16 '24 12:07 Hackwar

Done

I flagged some. There are more to remove.

Quy avatar Aug 10 '24 18:08 Quy

Done

I flagged some. There are more to remove.

No, I thoroughly went through them all at that time and all other instances are still in use.

Hackwar avatar Aug 10 '24 18:08 Hackwar

@Quy the code style checker should also throw an error when there are unused imports. So I guess we are fine here, or?

laoneo avatar Aug 14 '24 11:08 laoneo

@laoneo Yes. Please discard my comments.

Quy avatar Aug 14 '24 11:08 Quy

Thanks!

laoneo avatar Aug 14 '24 11:08 laoneo