?
avatar N6REJ
N6REJ
28 Jul 2020

Problem identified

file:
ToolbarButton.php

seems the $iconOver created in

ToolbarHelper::custom('template.cropImage', 'fas fa-crop', 'fas fa-arrows-alt', 'COM_TEMPLATES_BUTTON_CROP', false);

public static function custom($task = '', $icon = '', $iconOver = '', $alt = '', $listSelect = true, $formId = null)
{
	$bar = Toolbar::getInstance('toolbar');

	// Strip extension.
	$icon = preg_replace('#\.[^.]*$#', '', $icon);

	// Add a standard button.
	$bar->appendButton('Standard', $icon, $alt, $task, $listSelect, $formId);
}

Proposed solution

Open questions

How do we address this. I'm not sure where/how it is/should be used.

avatar N6REJ N6REJ - open - 28 Jul 2020
avatar joomla-cms-bot joomla-cms-bot - change - 28 Jul 2020
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 28 Jul 2020
avatar N6REJ N6REJ - change - 28 Jul 2020
The description was changed
avatar N6REJ N6REJ - edited - 28 Jul 2020
avatar N6REJ N6REJ - change - 28 Jul 2020
The description was changed
avatar N6REJ N6REJ - edited - 28 Jul 2020
avatar N6REJ N6REJ - change - 28 Jul 2020
The description was changed
avatar N6REJ N6REJ - edited - 28 Jul 2020
avatar N6REJ N6REJ - change - 28 Jul 2020
The description was changed
avatar N6REJ N6REJ - edited - 28 Jul 2020
avatar brianteeman
brianteeman - comment - 28 Jul 2020

$iconOver The image to display when moused over.

avatar N6REJ
N6REJ - comment - 29 Jul 2020

$iconOver The image to display when moused over.

correct, however, it doesn't & can't since the icon is never passed to the button.
Thats my point

avatar infograf768
infograf768 - comment - 29 Jul 2020

Indeed. Same in 3.x.
Useless param. It is a remaining of... Joomla 1.5...

avatar infograf768
infograf768 - comment - 29 Jul 2020

1.5

/**
	* Writes a custom option and task button for the button bar
	* @param string The task to perform (picked up by the switch($task) blocks
	* @param string The image to display
	* @param string The image to display when moused over
	* @param string The alt text for the icon image
	* @param boolean True if required to check that a standard list item is checked
	*/
	function custom( $task='', $icon=NULL, $iconOver='', $alt='', $listSelect=true ) {

		$icon 	= ( $iconOver ? $iconOver : $icon );
		$image 	= JHTML::_('image.site',  $icon, '/images/', NULL, NULL, $alt );

		if ($listSelect) {
			$message = JText::sprintf( 'Please make a selection from the list to', JText::_( $alt ) );
			$message = addslashes($message);
			$onclick = "javascript:if (document.adminForm.boxchecked.value == 0){ alert('".  $message . "');}else{submitbutton('$task')}";
		} else {
			$onclick = "javascript:submitbutton('$task')";
		}

		?>
		<td>
			<a class="toolbar" onclick="<?php echo $onclick ;?>">
				<?php echo $image; ?></a>
		</td>
		<?php
	}
avatar N6REJ
N6REJ - comment - 29 Jul 2020

then we should deprecate that option and remove all the existing $iconOvers from the toolbarhelper:: calls?

avatar infograf768
infograf768 - comment - 29 Jul 2020

OR add it into all possible occurrence of toolbar and modify the js to use it?

avatar infograf768
infograf768 - comment - 29 Jul 2020

I tested modifying
ToolbarHelper::custom('template.cropImage', 'fas fa-crop', 'fas fa-crop', 'COM_TEMPLATES_BUTTON_CROP', false);
by taking off one of the , 'fas fa-crop'

and the result is that the icon loses its opacity and can't be clicked i.e. disabled.

avatar infograf768
infograf768 - comment - 29 Jul 2020

It works again if I use
ToolbarHelper::custom('template.cropImage', 'fas fa-crop', 'whatever', 'COM_TEMPLATES_BUTTON_CROP', false);

weird...

avatar N6REJ
N6REJ - comment - 29 Jul 2020

where would the js be that creates the button?

avatar infograf768
infograf768 - comment - 30 Jul 2020

It also works fine with
ToolbarHelper::custom('template.cropImage', 'fas fa-crop', '', 'COM_TEMPLATES_BUTTON_CROP', false);

There are so many files concerned by toolbar that It's confusing.
Libraries/src/
Screen Shot 2020-07-30 at 08 12 20

Layouts
Screen Shot 2020-07-30 at 08 14 21

The js is created in media/system/js/ (from build/system/js/)
Screen Shot 2020-07-30 at 08 16 39

avatar N6REJ N6REJ - change - 23 Oct 2020
Status New Closed
Closed_Date 0000-00-00 00:00:00 2020-10-23 06:00:55
Closed_By N6REJ
avatar N6REJ N6REJ - close - 23 Oct 2020
avatar N6REJ
N6REJ - comment - 23 Oct 2020

discussion moved to #31211. Going to need input on best solution.

Add a Comment

Login with GitHub to post a comment