1

I'm adding a button to the toolbar using

JToolBarHelper::addNew('thing.add');

I want it to have the same effect as clicking on the following menu button:

    <menu
        view="thing"
        layout="add"
        img="class:banners"
        alt="Add thing"
        >
        Add thing
    </menu>

Is this possible? Seems like addNew cannot be used to use a view from another controller? I can get the button to use the method add from controller thing, but not to use view add from thing.

Edit: Fixed by messing around with controller/model naming.

1 Answer 1

1

Buttons point to a method in your controller. So create a method inside your thing controller called add and then use a redirect to send it to your correct view/layout.

If you are using standard Joomla MVC patterns the thing.add should take you to the edit layout of your view with an ID of 0.

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.