Social\Controller\AddThisController::addWidgetAction PHP Method

addWidgetAction() public method

Save widget
public addWidgetAction ( ) : mixed
return mixed
    public function addWidgetAction()
    {
        $this->form->addWidget('widget-add');
        $postData = $this->getRequest()->getPost()->toArray();
        $this->form->setData($postData);
        if ($this->getRequest()->isPost()) {
            if ($this->form->isValid()) {
                $this->model->addWidgets($this->form->getData());
                $this->flashMessenger()->addSuccessMessage('Widget added');
                return $this->redirect()->toRoute('module/social/addthis');
            }
        }
        $this->flashMessenger()->addErrorMessage('Cannot saved widget');
        return $this->forward()->dispatch('AddThisController', array('action' => 'index', 'isForwarded' => 'widgets'));
    }