? ? Pending

User tests: Successful: Unsuccessful:

avatar hans2103
hans2103
24 Aug 2020

This PR has influence on #30468 and #30464

Summary of Changes

This PR will prevent duplicate code.
Both layouts/joomla/button/iconclass.php and layouts/joomla/toolbar/iconclass.php are the same.
Merging both will make our code a bit DRY

Testing Instructions

Apply the PR and go to Joomla administrator or Joomla frontend and look for icons on buttons or in a toolbar.
There should be no change visible before or after applying the PR.

Actual result BEFORE applying this Pull Request

Buttons in the toolbar have icons

Expected result AFTER applying this Pull Request

Buttons in the toolbar have icons

Documentation Changes Required

The newly created Layout joomla.icon.iconclass has two parameters

  1. icon => name or className => the icon that should be displayed
  2. html => true/false to display html output or className only

Examples

call for className and as HTML output
use Joomla\CMS\Layout\LayoutHelper;

echo LayoutHelper::render('joomla.icon.iconclass', ['icon' => 'fa-folder-open', 'html' => true]);

this will render

<span class="fas fa-folder-open" aria-hidden="true"></span>
call for className and className output
use Joomla\CMS\Layout\LayoutHelper;

echo LayoutHelper::render('joomla.icon.iconclass', ['icon' => 'fa-folder-open']);

this will render

fas fa-folder-open
call for stateName and as HTML output
use Joomla\CMS\Layout\LayoutHelper;

echo LayoutHelper::render('joomla.icon.iconclass', ['icon' => 'published', 'html' => true ]);

this will render

<span class="fas fa-check" aria-hidden="true"></span>
call for stateName and as className output
use Joomla\CMS\Layout\LayoutHelper;

echo LayoutHelper::render('joomla.icon.iconclass', ['icon' => 'published' ]);

this will render

fas fa-check
avatar hans2103 hans2103 - open - 24 Aug 2020
avatar hans2103 hans2103 - change - 24 Aug 2020
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 24 Aug 2020
Category Layout Libraries
avatar hans2103 hans2103 - change - 24 Aug 2020
The description was changed
avatar hans2103 hans2103 - edited - 24 Aug 2020
avatar hans2103 hans2103 - change - 24 Aug 2020
Title
Feature/layouthelper for dry icons
[4.0] [JLayout] merge two equal JLayouts for iconclass into one new JLayout for iconclass
avatar hans2103 hans2103 - edited - 24 Aug 2020
avatar hans2103 hans2103 - change - 24 Aug 2020
Labels Added: ?
avatar hans2103 hans2103 - change - 24 Aug 2020
The description was changed
avatar hans2103 hans2103 - edited - 24 Aug 2020
avatar brianteeman
brianteeman - comment - 25 Aug 2020

Clearly the current code is not optimal but is merging the layouts the solution? I thought the whole point of layouts was that they were single purpose and could be overridden. Doesn't this change prevent that?

avatar hans2103
hans2103 - comment - 25 Aug 2020

@brianteeman This PR reduces duplicate code but keeps the possibility to override the origin.
Developers still can both toolbar/iconclass.php and button/iconclass.php the way they did before.
Both files echo the icon/iconclass.php
Both files where exactly the same and there is no use of maintaining two equal files.
We should try not to repeat ourself while coding.

content of layouts/joomla/toolbar/iconclass.php === content of layouts/joomla/button/iconclass.php
Only that should be reason enough to merge it into one file.

avatar brianteeman
brianteeman - comment - 25 Aug 2020

Files being identical is a consequence of the layouts concept.

Can the button still be overridden separately to the toolbar?

avatar hans2103
hans2103 - comment - 25 Aug 2020

Can the button still be overridden separately to the toolbar?

yes.. I haven't deleted both files. The only echo the new layout. You can override button/iconclass to your own template and go wild in the code. Same goed for toolbar/iconclass

avatar brianteeman
brianteeman - comment - 25 Aug 2020

@hans2103 much better now - thanks

avatar N6REJ
N6REJ - comment - 26 Aug 2020

nice to have @hans2103 working with me to take this project to the next step.

avatar Quy
Quy - comment - 26 Aug 2020

@N6REJ Close PR #30482?

avatar N6REJ
N6REJ - comment - 27 Aug 2020

@N6REJ Close PR #30482?
as I said in that pr, no, because they don't exactly replace each other. @hans2103 and I are working together and they will be merged appropiately

avatar Quy Quy - test_item - 28 Aug 2020 - Tested successfully
avatar Quy
Quy - comment - 28 Aug 2020

I have tested this item successfully on a62d5b5


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/30470.

avatar jwaisner jwaisner - test_item - 28 Aug 2020 - Tested successfully
avatar jwaisner
jwaisner - comment - 28 Aug 2020

I have tested this item successfully on a62d5b5


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/30470.

avatar jwaisner jwaisner - change - 28 Aug 2020
Status Pending Ready to Commit
avatar jwaisner
jwaisner - comment - 28 Aug 2020

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/30470.

avatar hans2103 hans2103 - change - 31 Aug 2020
Labels Added: ?
avatar hans2103
hans2103 - comment - 31 Aug 2020

please remove RTC while some changes from @N6REJ needs to be applied into it

avatar richard67 richard67 - change - 31 Aug 2020
Status Ready to Commit Pending
avatar richard67
richard67 - comment - 31 Aug 2020

Back to pending status as requested by the author.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/30470.

avatar hans2103 hans2103 - change - 31 Aug 2020
Labels Removed: ?
avatar N6REJ N6REJ - test_item - 31 Aug 2020 - Tested successfully
avatar N6REJ
N6REJ - comment - 31 Aug 2020

I have tested this item successfully on 1b4e36b

#30468

and

#30482

now merged with this pr so will close them.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/30470.

avatar N6REJ N6REJ - test_item - 4 Sep 2020 - Tested successfully
avatar N6REJ
N6REJ - comment - 4 Sep 2020

I have tested this item successfully on 0d1156a

works as expected


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/30470.

avatar hans2103
hans2103 - comment - 6 Sep 2020

merged recent 4.0-dev updates and solved merge conflict

avatar Formatio-hippocampi Formatio-hippocampi - test_item - 7 Sep 2020 - Tested successfully
avatar Formatio-hippocampi
Formatio-hippocampi - comment - 7 Sep 2020

I have tested this item successfully on b00f232


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/30470.

avatar paternax paternax - test_item - 7 Sep 2020 - Tested successfully
avatar paternax paternax - test_item - 7 Sep 2020 - Tested successfully
avatar paternax
paternax - comment - 7 Sep 2020

I have tested this item successfully on b00f232


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/30470.

avatar paternax
paternax - comment - 7 Sep 2020

I have tested this item successfully on b00f232


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/30470.

avatar richard67 richard67 - change - 7 Sep 2020
Status Pending Ready to Commit
avatar richard67
richard67 - comment - 7 Sep 2020

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/30470.

avatar infograf768 infograf768 - change - 11 Sep 2020
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2020-09-11 08:41:59
Closed_By infograf768
Labels Added: ?
avatar infograf768 infograf768 - close - 11 Sep 2020
avatar infograf768 infograf768 - merge - 11 Sep 2020
avatar infograf768
infograf768 - comment - 11 Sep 2020

Thanks

Add a Comment

Login with GitHub to post a comment