Use JHtml::_('grid.published', $obj, $i)
code for an icon with javascript to publish/unpublish an item
e.g. in Joomla 3:
<a href="#" onclick="return listItemTask('cb0','unpublish')" title="Unpublish Item"><img src="/administrator/templates/isis/images/admin/tick.png" alt="Published" /></a> 
<a href="#" onclick="return Joomla.listItemTask('cb0','unpublish')" title="Unpublish Item"><img src="" alt="Published" ></a> 
The img src field is empty. There is no admin directory in templates/cassiopeia/imagies/. Does cassiopeia use a symbol font for the published icon?
I am migrating code from Joomla 3 to Joomla 4; this call seems to be intended to work, but something is missing. Maybe the names of the icon files changed?
| Labels | 
                                                                Removed: 
?
 | 
    ||
| Labels | 
                                        Added: 
No Code Attached Yet
 | 
    ||
Thanks for the tip; this works. I wonder what
JHtml::_('grid.published')
is meant for, but this solved my problem!
| Title | 
            
            
  | 
    ||||||
@mastervanleeuwen thanks for feedback! Could you close the issue, please?
| Status | New | ⇒ | Closed | 
| Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2021-10-27 12:00:12 | 
| Closed_By | ⇒ | mastervanleeuwen | 
Sorry for insisting, but this still leaves the question open why the grid.published function
has 'tick.png' and 'publish_x.png' as default arguments; it looks like the code cannot find these files; is that intentional?
@mastervanleeuwen Better migrate your code to use
jgrid.publishedinstead. Your old code could be changed to :Or better, using namespace code:
That's how I did while migrating my extensions to Joomla 4.