Monday, June 26, 2017

Login

Don't have an account yet? Register now!

Create an account

Fields marked with an asterisk (*) are required.

joomla unpublished task not call in controller

hanif
hanif
Offline
0
I would like to use joomla unpublish function in my custom component.i have create two function "publish" and "unpublish" in my controller file but it's not called.What can i do here?
Responses (1)
  • Accepted Answer

    jguru
    jguru
    Offline
    Saturday, November 21 2015, 11:01 AM - #permalink
    0
    No need to create two different function just create publish function and you can get task name with $task = $this->getTask(); in publish function.
    public function publish()
    {
    $task = $this->getTask();

    // Do your custom actions
    if($task == 'unpublish'){
    // Do something on unpublishing item(s)
    }else if($task == 'publish'){
    // Do something on publishing item(s)
    }

    // Call parent function, so item(s) will get published/unpublished like they are used to
    parent::publish();
    }
    The reply is currently minimized Show
Your Reply