16 use Magento\Ui\Api\Data\BookmarkInterfaceFactory;
85 \
Magento\Framework\Serialize\Serializer\Json $serializer =
null 87 parent::__construct($context,
$factory);
94 ->get(\
Magento\Framework\Serialize\Serializer\Json::class);
106 $bookmark = $this->bookmarkFactory->create();
107 $jsonData = $this->_request->getParam(
'data');
109 throw new \InvalidArgumentException(
'Invalid parameter "data"');
111 $data = $this->serializer->unserialize($jsonData);
112 $action = key(
$data);
122 $bookmark->getTitle(),
129 foreach (
$data[$action] as $identifier =>
$data) {
142 throw new \LogicException(
__(
'Unsupported bookmark action.'));
158 if ($updateBookmark !==
false) {
159 $bookmark = $updateBookmark;
162 $bookmark->
setUserId($this->userContext->getUserId())
163 ->setNamespace($this->_request->getParam(
'namespace'))
164 ->setIdentifier($identifier)
167 $this->bookmarkRepository->save($bookmark);
178 $bookmarks = $this->bookmarkManagement->loadByNamespace($this->_request->getParam(
'namespace'));
179 foreach (
$bookmarks->getItems() as $bookmark) {
180 if ($bookmark->getIdentifier() == $identifier) {
181 $bookmark->setCurrent(
true);
183 $bookmark->setCurrent(
false);
185 $this->bookmarkRepository->save($bookmark);
199 $updateBookmark = $this->bookmarkManagement->getByIdentifierNamespace(
201 $this->_request->getParam(
'namespace')
204 if ($updateBookmark) {
updateCurrentBookmark($identifier)
__construct(Context $context, UiComponentFactory $factory, BookmarkRepositoryInterface $bookmarkRepository, BookmarkManagementInterface $bookmarkManagement, BookmarkInterfaceFactory $bookmarkFactory, UserContextInterface $userContext, DecoderInterface $jsonDecoder, \Magento\Framework\Serialize\Serializer\Json $serializer=null)
updateBookmark(BookmarkInterface $bookmark, $identifier, $title, $config)
checkBookmark($identifier)