bookmarkRepository = $bookmarkRepository; $this->bookmarkManagement = $bookmarkManagement; } /** * Get component name * * @return string */ public function getComponentName() { return static::NAME; } /** * 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())); parent::prepare(); $jsConfig = $this->getConfiguration(); $this->getContext()->addComponentDefinition($this->getComponentName(), $jsConfig); } }