2

I've implemented a dashboard into a component with an option to update the components configuration parameters. What I want to do is return to the dashboard on Save of the options. I notice that there is a "path" and "return" element to the URL in the link element of the menu option I've created but I can't seem to get the return back to the dashboard.

    <menuitem
        title="COM_MYCOMPONENT_CONFIGURATION"
        type="component"
        element="com_config"
        link="index.php?option=com_config&amp;view=component&amp;component=com_mycomponent&amp;path=&amp;return="
    />

Does anyone know how to do this? All pointers appreciated.

1 Answer 1

1

You can use the return part in the url to achieve want you want. Basically, the return= is the base64encoded string of the last used url or whatever url you want.

//To compute the return
$return = base64_encode(\JRoute::_('index.php?option=mycomponent&view=dashboard'));

//To show what is the base64 encoded dashboard url
echo $return;


<menuitem
        title="COM_MYCOMPONENT_CONFIGURATION"
        type="component"
        element="com_config"
        link="index.php?option=com_config&amp;view=component&amp;component=com_mycomponent&amp;path=&amp;return=PASTE_THE_CONTENT_OF_THE_BASE64_ENCODED_DASHBOARD_URL_HERE"
    />

If you cannot do it via php use an online tool to compute the base64 encoded version of your dashboard url then paste it after return=

2
  • Ahh brilliant, thank you very much, I'll give that a go. I didn't think of encoding the url. Cheers. Dec 22, 2021 at 2:26
  • No problem. Enjoy your day @GlennArkell Dec 22, 2021 at 15:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.