Example #1
0
 protected function toggle($cid, $publish)
 {
     if (empty($cid)) {
         JError::raiseWarning(500, 'No items selected');
     }
     $this->plugin = JRequest::getCmd('name', '');
     $this->plugin_type = JRequest::getCmd('plugin_type', 'generator');
     if (empty($this->plugin) || !in_array($this->plugin_type, array('generator', 'consumer', 'plugin'))) {
         return false;
     }
     $data = hikaserial::import('hikaserial', $this->plugin);
     if ($data === false) {
         return false;
     }
     if (!$data->isMultiple()) {
         JError::raiseWarning(500, 'Not allowed');
     }
     if (isset($data->toggle)) {
         $this->toggle = $data->toggle;
     } else {
         $this->toggle = array($this->type . '_published' => $this->type . '_id');
     }
     JRequest::setVar('subtask', '');
     $this->publish_return_view = 'edit';
     return parent::toggle($cid, $publish);
 }