5

As seen in this question (Add a custom button to a core backend component), I've created a simple plugin that adds a custom button on the com_content component.

When I click on this button, the site is redirected to the my_component controller, send task. But any of the selected items is sent to the my_component controller.

What should I do to pass the id of the selected articles to my controller?

Here is the source of my plugin:

class plgSystemSubscripcions extends JPlugin {
    public function onBeforeRender() {
        $app = JFactory::getApplication();

        if ($app->isAdmin() === true) {
            $input = $app->input;

            if (($input->getCmd('option') === 'com_content' && $input->getCmd('view', 'articles') ===  'articles') ||
                ($input->getCmd('option') === 'com_docman'  && $input->getCmd('view', 'documents') === 'documents')) {
                $toolbar = JToolbar::getInstance('toolbar');

                $url = JRoute::_('index.php?option=com_my_component&task=send&format=raw');
                $toolbar->appendButton('Link', 'mail', 'Mass email', $url);
            }
        }
    }
}
2

Your button invokes only GET action. That means all input fields are not processed, but selected items are input fields. See the same problem in this question.

Honestly I do not see any way how to pass them... If your button could submit a form that would do the trick, but as I understand it is not possible for custom buttons.

  • Wow, this is a big problem... Maybe I should create a complete backend module which shows all the articles and documents, with the "correct" button to send the emails... – mHouses Jan 19 '15 at 9:42
  • 1
    I think that for this you will need a component not a module. Module is too small to show such a big portion of data. – Dmitry Rekun Jan 20 '15 at 12:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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