-
Notifications
You must be signed in to change notification settings - Fork 9.4k
[Widgets] Mass-action delete for Widgets #20765
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Widgets] Mass-action delete for Widgets #20765
Conversation
Hi @vasilii-b. Thank you for your contribution
For more details, please, review the Magento Contributor Assistant documentation |
if (count($notDeletedInstances)) { | ||
$this->messageManager->addErrorMessage(__( | ||
'Widget(s) with ID(s) %1 were not found', | ||
implode(',', $notDeletedInstances) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add an additional space after the comma in the implode functions. So we have in result 1, 2, 30
instead of 1,2,30
public function execute(int $id) | ||
{ | ||
$model = $this->getById($id); | ||
var_dump($model->getData(), $id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe it should not be here :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯 😆
* @return WidgetInstance | ||
* @throws NoSuchEntityException | ||
*/ | ||
private function getById(int $id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you rename it to getWidgetById, please?
* Command to delete a widget instance by specified widget instance ID | ||
* @api | ||
*/ | ||
interface DeleteWidgetInstanceByIdInterface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have doubts regarding a necessity to use an API interface in this particular case. It might be useful if we create an additional web API endpoint or we need to define a strategy in an interface for multiple implementations. But it's not the case.
The main downside of using an interface here - it does not make much sense. In the future, the interface restricts us in possible architectural changes (if the implementation needs to be changed). So if we declare an interface we are responsible for its support. On the other hand, if we don't have an interface we can change the implementation in more flexible ways.
So the main idea is to use API interfaces only in cases when they are useful but not harmful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it! I'll adjust it. Thank you!
Hi @rogyar, can you please have a look on added changes? Thank you! |
/** | ||
* Class DeleteWidgetInstanceById | ||
*/ | ||
class DeleteWidgetInstanceById |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, rename it to DeleteWidgetById
@@ -0,0 +1,73 @@ | |||
<?php |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, use strict_types declaration in new implementations
app/code/Magento/Widget/Controller/Adminhtml/Widget/Instance/MassDelete.php
Show resolved
Hide resolved
app/code/Magento/Widget/etc/di.xml
Outdated
@@ -34,4 +34,6 @@ | |||
<plugin name="widget-layout-update-plugin" | |||
type="Magento\Widget\Model\ResourceModel\Layout\Plugin" sortOrder="10"/> | |||
</type> | |||
<preference for="Magento\Widget\Api\DeleteWidgetInstanceByIdInterface" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we don't need this config anymore
@vasilii-b , I am closing this PR now due to inactivity. |
Hi @vasilii-b, thank you for your contribution! |
…lk-delete * origin/2.3-develop: (4954 commits) magento#23427 Fix static magento#23532 Fix-static-tests magento/magento#23500 fix funk tests fix validation class for max-words MC-17922: Date in filter area doesn't match with Active filters bar Fixed coding standards violations Updated unit test MC-17922: Date in filter area doesn't match with Active filters bar Update Framework/Mail::Message to send all emails as MIME, not just HTML emails. MC-17922: Date in filter area doesn't match with Active filters bar Removed editors from all dependable customer billing address fields Correct array type hints Fix mass detection issue Testing configurable option update based on product and attribute_id move breakpoint by -1px to make nav work correctly at viweport width of 768px MC-17275: Admin Down after changing store domain/cookie Setting right shipper street1 in addressline1 MC-17275: Admin Down after changing store domain/cookie Replaced urldecode with rawurldecode that not converting + into space Fixed issue magento#23383 ...
# Fixed codestyle and added improvements requested by maintainer
Hi @vasilii-b. Thank you for your contribution
For more details, please, review the Magento Contributor Assistant documentation |
Hi @sidolov, thank you for the review.
|
✔️ QA passed |
Hi @vasilii-b, thank you for your contribution! |
Description (*)
This PR adds massaction delete to Widget Instances

Fixed Issues (if relevant)
Manual testing scenarios (*)
Provided in issue description
Contribution checklist (*)