Advertisement

Help button in backend: window has no "Back" button Topic is solved

For Joomla! 4.x Coding related discussions, you could also use: http://groups.google.com/group/joomla-dev-general

Moderators: ooffick, General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Post Reply
david0058
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 112
Joined: Wed Jan 20, 2016 10:58 pm

Help button in backend: window has no "Back" button

Post by david0058 » Sun Jun 30, 2024 11:00 am

I have a backend component that shows help pages stored as articles, which contain links to other articles. This is triggered from the "Help" button in the menu bar.

However, the browser window that pops up to display the help information doesn't have Back/Forward/Refresh buttons (in fact the whole address bar is missing). It seems to assume that there can only be a monolithic help page per screen.

Is there any way to enable these?

Cheers,

David

Advertisement
User avatar
ceford
Joomla! Hero
Joomla! Hero
Posts: 2942
Joined: Mon Feb 24, 2014 10:38 pm
Location: Edinburgh, Scotland
Contact:

Re: Help button in backend: window has no "Back" button

Post by ceford » Wed Jul 03, 2024 2:55 pm

In Firefox, if you right click on the Help page there is a popup menu with Backwards, Forwards and Reload links. Not the answer to your question but it might be a useful tip.

david0058
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 112
Joined: Wed Jan 20, 2016 10:58 pm

Re: Help button in backend: window has no "Back" button

Post by david0058 » Mon Jul 08, 2024 1:32 pm

Thanks, that was the best I could come up with too, works on Chrome and Safari too.

It's not very intuitive tho', and many users don't know about right-clicking. I'll have a trawl through the core code and see if I can figure out how the Joomla team managed to hide the address bar buttons.

david0058
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 112
Joined: Wed Jan 20, 2016 10:58 pm

Re: Help button in backend: window has no "Back" button

Post by david0058 » Tue Oct 15, 2024 11:13 am

OK, in case anyone else has this problem, here's how I solved it ...

This code goes in .../administrator/views/xxx/view.html.php:

Code: Select all

    public function display($tpl = null)
    {
        $this->item  = $this->get('Item');

        // Check for errors.
        if (count($errors = $this->get('Errors')))
            throw new Exception(implode("\n", $errors), 500);

        $this->addToolbar();
        parent::display($tpl);
    }
    
    protected function addToolbar()
    {   
        JToolBarHelper::custom('dummyTask', 'arrow-left', 'arrow-left', 'Back', false);

        $doc = JFactory::getDocument();
        $doc->addScriptDeclaration("

            document.addEventListener('DOMContentLoaded', function() {
                var button = document.querySelector('#toolbar-arrow-left');
        
                if (button) {

                    if (window.history.length === 1) {
                        button.setAttribute('disabled', 'disabled');
                        button.setAttribute('aria-disabled', 'true');
                        button.classList.add('disabled');
                        button.style.pointerEvents = 'none'; 
                    }
                    else {
                        button.addEventListener('click', function(event) {
                            event.preventDefault();  
                            window.history.back(); 
                        });
                    }
                }
            });
        ");

        if (JFactory::getUser()->authorise('core.admin', 'com_component_name'))
            JToolBarHelper::preferences('com_component_name');
        else
            JFactory::getApplication()->input->set('hidemainmenu', true);

        JToolBarHelper::title(JText::_($this->item->title, 'help'));
    }

Advertisement

Post Reply

Return to “Joomla! 4.x Coding”