Exemplo n.º 1
0
 /**
  * Action for AJAX request
  *
  * @return void
  */
 public function execute()
 {
     $viewIds = explode('.', $this->_request->getParam('data'));
     $bookmark = $this->bookmarkManagement->getByIdentifierNamespace(array_pop($viewIds), $this->_request->getParam('namespace'));
     if ($bookmark && $bookmark->getId()) {
         $this->bookmarkRepository->delete($bookmark);
     }
 }
Exemplo n.º 2
0
 /**
  * Check bookmark by identifier
  *
  * @param string $identifier
  * @return bool|BookmarkInterface
  */
 protected function checkBookmark($identifier)
 {
     $result = false;
     $updateBookmark = $this->bookmarkManagement->getByIdentifierNamespace($identifier, $this->_request->getParam('namespace'));
     if ($updateBookmark) {
         $result = $updateBookmark;
     }
     return $result;
 }
Exemplo n.º 3
0
 /**
  * Register component
  *
  * @return void
  */
 public function prepare()
 {
     $namespace = $this->getContext()->getRequestParam('namespace', $this->getContext()->getNamespace());
     $config = [];
     if (!empty($namespace)) {
         $bookmarks = $this->bookmarkManagement->loadByNamespace($namespace);
         /** @var \Magento\Ui\Api\Data\BookmarkInterface $bookmark */
         foreach ($bookmarks->getItems() as $bookmark) {
             if ($bookmark->isCurrent()) {
                 $config['activeIndex'] = $bookmark->getIdentifier();
             }
             $config = array_merge_recursive($config, $bookmark->getConfig());
         }
     }
     $this->setData('config', array_replace_recursive($config, $this->getConfiguration($this)));
     parent::prepare();
     $jsConfig = $this->getConfiguration($this);
     $this->getContext()->addComponentDefinition($this->getComponentName(), $jsConfig);
 }