joomla / joomla-cms

Home of the Joomla! Content Management System
https://www.joomla.org
GNU General Public License v2.0
4.78k stars 3.65k forks source link

CoreButtonsTrait back() generates wrong button text #44432

Closed Steinweber closed 3 days ago

Steinweber commented 2 weeks ago

Steps to reproduce the issue

$toolbar = Toolbar::getInstance(); $toolbar->back('foobar');

Expected result

<a href="javascript:history.back();">foobar</a>

Actual result

<a href="javascript:history.back();">back</a>

System information (as much as possible)

5.2.0

Additional comments

https://github.com/joomla/joomla-cms/blob/30a64b3fcc07fa643184ee48137e92f239868582/libraries/src/Toolbar/CoreButtonsTrait.php#L155 Current:

public function back(string $text = 'JTOOLBAR_BACK'): LinkButton
    {
        return $this->link('back', $text)
            ->url('javascript:history.back();');
    }

Solution:

public function back(string $text = 'JTOOLBAR_BACK'): LinkButton
    {
        return $this->link($text, 'javascript:history.back();');
    }
chmst commented 1 week ago

@Steinweber as you know the solution, would you like to make a PR?

Quy commented 3 days ago

PR #44509