Skip to content

Commit

Permalink
Version 1.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
magenizr committed Apr 19, 2023
1 parent 36a862c commit 25a1702
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 36 deletions.
3 changes: 1 addition & 2 deletions Controller/Adminhtml/Reset/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ public function execute()
$params = $this->request->getParam('magenizr_resetuibookmarks');

$userId = $this->_auth->getUser()->getId();



if (!empty($params['userId'])) {

$system = false;
Expand Down
54 changes: 31 additions & 23 deletions Plugin/Block/Adminhtml/User/Edit/Tab/ResetUiBookmarks.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,37 +14,45 @@ class ResetUiBookmarks
*/
public function aroundGetFormHtml(
\Magento\User\Block\User\Edit\Tab\Main $subject,
\Closure $proceed
\Closure $proceed
) {
$form = $subject->getForm();
if (is_object($form)) {
$fieldset = $form->getElement('base_fieldset');
$userId = 0;

foreach ($fieldset->getElements() as $element) {
if (get_class($form) !== \Magento\Framework\Data\Form::class) {
return $proceed();
}

$userId = 0;
$fieldset = $form->getElement('base_fieldset');

if ($element->getId() === 'user_id') {
$userId = $element->getValue();
}
foreach ($fieldset->getElements() as $element) {

if ($element->getId() === 'user_id') {
$userId = $element->getValue();
break;
}
}

$fieldset = $form->addFieldset('magenizr_resetuibookmarks', ['legend' => __('Bookmarks')]);

$fieldset->addField(
'reset_ui_bookmarks',
'label',
[
'container_id' => 'reset_ui_bookmarks',
'after_element_html' => $subject->getLayout()
->getBlock('magenizr.resetuibookmarks.system.account')
->setData('userId', $userId)
->toHtml()
]
);

$subject->setForm($form);
if ($userId === 0) {
return $proceed();
}

$fieldset = $form->addFieldset('magenizr_resetuibookmarks', ['legend' => __('Bookmarks')]);

$fieldset->addField(
'reset_ui_bookmarks',
'label',
[
'container_id' => 'reset_ui_bookmarks',
'after_element_html' => $subject->getLayout()
->getBlock('magenizr.resetuibookmarks.system.account')
->setData('userId', $userId)
->toHtml()
]
);

$subject->setForm($form);

return $proceed();
}
}
23 changes: 13 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,35 +17,34 @@ Usually a technical person ( e.g developer ) is required to reset those filters

## Installation (Composer)

1. Update your composer.json `composer require "magenizr/magento2-resetuibookmarks":"1.2.1" --no-update`
1. Update your composer.json `composer require "magenizr/magento2-resetuibookmarks":"1.2.2" --no-update`
2. Install dependencies and update your composer.lock `composer update magenizr/magento2-resetuibookmarks --lock`

```
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
- Installing magenizr/magento2-resetuibookmarks (1.2.1): Downloading (100%)
- Installing magenizr/magento2-resetuibookmarks (1.2.2): Downloading (100%)
Writing lock file
Generating autoload files
```

3. Enable the module and clear static content.

```
php bin/magento module:enable Magenizr_ResetUiBookmarks --clear-static-content
php bin/magento setup:upgrade
php bin/magento module:enable Magenizr_ResetUiBookmarks
```

## Installation (Composer 2)

1. Update your composer.json `composer require "magenizr/magento2-resetuibookmarks":"1.2.1" --no-update`
1. Update your composer.json `composer require "magenizr/magento2-resetuibookmarks":"1.2.2" --no-update`
2. Use `composer update magenizr/magento2-resetuibookmarks --no-install` to update your composer.lock file.

```
Updating dependencies
Lock file operations: 1 install, 1 update, 0 removals
- Locking magenizr/magento2-resetuibookmarks (1.2.1)
- Locking magenizr/magento2-resetuibookmarks (1.2.2)
```

3. And then `composer install` to install the package.
Expand All @@ -54,19 +53,18 @@ Lock file operations: 1 install, 1 update, 0 removals
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Package operations: 1 install, 0 update, 0 removals
- Installing magenizr/magento2-resetuibookmarks (1.2.1): Extracting archive
- Installing magenizr/magento2-resetuibookmarks (1.2.2): Extracting archive
```

4. Enable the module and clear static content.

```
php bin/magento module:enable Magenizr_ResetUiBookmarks --clear-static-content
php bin/magento setup:upgrade
php bin/magento module:enable Magenizr_ResetUiBookmarks
```

## Installation (Manually)
1. Download the code.
2. Extract the downloaded tar.gz file. Example: `tar -xzf Magenizr_ResetUiBookmarks_1.2.1.tar.gz`.
2. Extract the downloaded tar.gz file. Example: `tar -xzf Magenizr_ResetUiBookmarks_1.2.2.tar.gz`.
3. Copy the code into `./app/code/Magenizr/ResetUiBookmarks/`.
4. Enable the module and clear static content.

Expand All @@ -93,6 +91,11 @@ This module is available for free on [GitHub](https://github.com/magenizr). If y
Follow us on [GitHub](https://github.com/magenizr), [Twitter](https://twitter.com/magenizr) and [Facebook](https://www.facebook.com/magenizr).

## History
===== 1.2.2 =====
* 2.4.6 compatibility check
* Code cleanup
* Improved $form and $userId check

===== 1.2.1 =====
* Validation issue ( `Cannot read properties of undefined (reading 'settings')` ) on `Save User` action fixed.

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "magenizr/magento2-resetuibookmarks",
"description": "This Magento 2 module allows you to reset your UI bookmarks such as state of filters, column positions, grid sorting, pagination and so on.",
"type": "magento2-module",
"version": "1.2.1",
"version": "1.2.2",
"license": [
"OSL-3.0"
],
Expand Down

0 comments on commit 25a1702

Please sign in to comment.