diff --git a/layouts/joomla/button/action-button.php b/layouts/joomla/button/action-button.php index 5974badb145ba..712892a6cd177 100644 --- a/layouts/joomla/button/action-button.php +++ b/layouts/joomla/button/action-button.php @@ -46,5 +46,9 @@ class="js-grid-item-action tbody-icon data-state-escape($value diff --git a/libraries/src/Button/ActionButton.php b/libraries/src/Button/ActionButton.php index 70f1743826d79..a8c4fc15c545d 100644 --- a/libraries/src/Button/ActionButton.php +++ b/libraries/src/Button/ActionButton.php @@ -191,6 +191,14 @@ public function render(?int $value = null, ?int $row = null, array $options = [] ] ); + /** + * A disabled button cannot be used, so do not show its call-to-action text in the tooltip. + * Informational text can still be shown by passing it as the `disabled_title` option. + */ + if (!empty($data['options']['disabled']) && (string) $data['options']['tip_title'] !== '') { + $data['title'] = $data['options']['disabled_title'] ?? ''; + } + $data['row'] = $row; $data['icon'] = $this->fetchIconClass($data['icon']); diff --git a/libraries/src/Button/FeaturedButton.php b/libraries/src/Button/FeaturedButton.php index a2225ea11c73d..20525532eda73 100644 --- a/libraries/src/Button/FeaturedButton.php +++ b/libraries/src/Button/FeaturedButton.php @@ -99,6 +99,9 @@ public function render(?int $value = null, ?int $row = null, array $options = [] $default['title'] = $tip; + // Keep the informational dates in the tooltip when the button is disabled + $options['disabled_title'] = $tip; + $options['tip_title'] = Text::_('JLIB_HTML_FEATURED_ITEM'); if ($featuredUp && $nowDate < $featuredUp->toUnix()) { diff --git a/libraries/src/Button/PublishedButton.php b/libraries/src/Button/PublishedButton.php index 67492efdbf082..23c6593a947a2 100644 --- a/libraries/src/Button/PublishedButton.php +++ b/libraries/src/Button/PublishedButton.php @@ -71,11 +71,16 @@ public function render(?int $value = null, ?int $row = null, array $options = [] // Create special titles for published items if ($value === 1) { // Create tip text, only we have publish up or down settings - $tips = []; + $tips = []; + $disabled = !empty($options['disabled']) || $this->getOption('disabled'); if ($publishUp) { $tips[] = Text::sprintf('JLIB_HTML_PUBLISHED_START', HTMLHelper::_('date', $publishUp, Text::_('DATE_FORMAT_LC5'), 'UTC')); - $tips[] = Text::_('JLIB_HTML_PUBLISHED_UNPUBLISH'); + + // Only show the call-to-action when the user can actually change the state + if (!$disabled) { + $tips[] = Text::_('JLIB_HTML_PUBLISHED_UNPUBLISH'); + } } if ($publishDown) { @@ -86,6 +91,9 @@ public function render(?int $value = null, ?int $row = null, array $options = [] $default['title'] = $tip; + // Keep the informational dates in the tooltip when the button is disabled + $options['disabled_title'] = $tip; + $options['tip_title'] = Text::_('JLIB_HTML_PUBLISHED_ITEM'); if ($publishUp && $nowDate < $publishUp->toUnix()) {