src/ScContent/Controller/Back/WidgetVisibilityController.php
public function indexAction()
    {
        $visibilityService = $this->getVisibilityService();
        $options = $visibilityService->getOptions();

        $widgetId = $options->getWidgetId();
        if (! $widgetId) {
            $this->flashMessenger()->addMessage(
                $this->scTranslate('The widget identifier was not specified.')
            );
            return $this->redirect()
                ->toRoute('sc-admin/layout')
                ->setStatusCode(303);
        }

        $widget = $this->deriveWidget($widgetId);
        if (empty($widget)) {
            return $this->getResponse();
        }
        if ($this->getRequest()->isPost()) {
            $event = $this->request->getPost('suboperation');
            if (! empty($event)) {
                $events = $this->getEventManager();
                $params = $this->getRequest()->getPost();
                $params['widget_id'] = $widget->getId();
                $result = $events->trigger($event, $this, $params);
                if ($result->last() instanceof Response) {
                    return $result->last();
                }
            }
        }

        $view = new ViewModel;
        $view->options = $options;
        $view->widget = $widget;

        $moduleOptions = $this->getModuleOptions();
        $view->config = $moduleOptions->getWidgetByName($widget->getName());

        $view->list = $visibilityService->getContentList();
        $visibilityService->saveOptions();

        return $view;
    }
public function indexAction()
    {
        $visibilityService = $this->getVisibilityService();
        $options = $visibilityService->getOptions();

        $widgetId = $options->getWidgetId();
        if (! $widgetId) {
            $this->flashMessenger()->addMessage(
                $this->scTranslate('The widget identifier was not specified.')
            );
            return $this->redirect()
                ->toRoute('sc-admin/layout')
                ->setStatusCode(303);
        }

        $widget = $this->deriveWidget($widgetId);
        if (empty($widget)) {
            return $this->getResponse();
        }
        if ($this->getRequest()->isPost()) {
            $event = $this->request->getPost('suboperation');
            if (! empty($event)) {
                $events = $this->getEventManager();
                $params = $this->getRequest()->getPost();
                $params['widget_id'] = $widget->getId();
                $result = $events->trigger($event, $this, $params);
                if ($result->last() instanceof Response) {
                    return $result->last();
                }
            }
        }

        $view = new ViewModel;
        $view->options = $options;
        $view->widget = $widget;

        $moduleOptions = $this->getModuleOptions();
        $view->config = $moduleOptions->getWidgetByName($widget->getName());

        $view->list = $visibilityService->getContentList();
        $visibilityService->saveOptions();

        return $view;
    }
public function indexAction ( ) { $ visibilityService = $ this -> getVisibilityService ( ) ; $ options = $ visibilityService -> getOptions ( ) ; $ widgetId = $ options -> getWidgetId ( ) ; if ( ! $ widgetId ) { $ this -> flashMessenger ( ) -> addMessage ( $ this -> scTranslate ( 'The widget identifier was not specified.' ) ) ; return $ this -> redirect ( ) -> toRoute ( 'sc-admin/layout' ) -> setStatusCode ( 303 ) ; } $ widget = $ this -> deriveWidget ( $ widgetId ) ; if ( empty ( $ widget ) ) { return $ this -> getResponse ( ) ; } if ( $ this -> getRequest ( ) -> isPost ( ) ) { $ event = $ this -> request -> getPost ( 'suboperation' ) ; if ( ! empty ( $ event ) ) { $ events = $ this -> getEventManager ( ) ; $ params = $ this -> getRequest ( ) -> getPost ( ) ; $ params [ 'widget_id' ] = $ widget -> getId ( ) ; $ result = $ events -> trigger ( $ event , $ this , $ params ) ; if ( $ result -> last ( ) instanceof Response ) { return $ result -> last ( ) ; } } } $ view = new ViewModel ; $ view -> options = $ options ; $ view -> widget = $ widget ; $ moduleOptions = $ this -> getModuleOptions ( ) ; $ view -> config = $ moduleOptions -> getWidgetByName ( $ widget -> getName ( ) ) ; $ view -> list = $ visibilityService -> getContentList ( ) ; $ visibilityService -> saveOptions ( ) ; return $ view ; }
Show content list with widget visibility options.

@return \Zend\Stdlib\ResponseInterface|\Zend\View\Model\ViewModel
Show content list with widget visibility options .