Пример #1
0
 /**
  * Set the success message, if one has been assigned.
  *
  * @return \Dewdrop\Admin\ResponseHelper\Standard
  */
 public function executeSuccessMessage()
 {
     if ($this->successMessage) {
         if ($this->session instanceof WP_Session) {
             $this->session['successMessage'] = $this->successMessage;
         } else {
             $this->session->set('successMessage', $this->successMessage);
         }
     }
     return $this;
 }
Пример #2
0
 /**
  * Ensure the user is allowed to view the listing in this component.
  */
 public function init()
 {
     $this->component->getPermissions()->haltIfNotAllowed('view-listing');
     $this->session = new Session();
     $this->session->set($this->component->getListingQueryParamsSessionName(), $this->request->getQuery());
     if ($this->component instanceof SortableListingInterface) {
         $fields = $this->component->getFields();
         $sortField = $this->component->getSortField();
         if (!$fields->has($sortField)) {
             $fields->add($sortField);
         }
         /* @var $sorter \Dewdrop\Fields\Helper\SelectSort */
         $sorter = $this->component->getListing()->getSelectModifierByName('SelectSort');
         $sorter->setDefaultField($sortField);
     }
 }
Пример #3
0
 /**
  * Ensure the user is allowed to view the listing in this component.
  */
 public function init()
 {
     $this->component->getPermissions()->haltIfNotAllowed('view-listing');
     $this->session = new Session(Pimple::getInstance());
     $this->session->set($this->component->getListingQueryParamsSessionName(), $this->request->getQuery());
 }
Пример #4
0
 public function testCanProvideAPimpleObjectWithSessionAccessResource()
 {
     $pimple = new PimpleProper();
     $pimple['session.access'] = $pimple->share(function () {
         return new WpSessionAccess(new ArrayObject());
     });
     $session = new Session($pimple);
     $this->assertEquals($pimple['session.access'], $session->getAccessObject());
 }