-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Changed Validation to get store for block #11601
Conversation
So as far I a see this fixes the issue raised but there is another issue with the block validation. In my testing I setup a multi store system so there are two store views for a website. I then added 2 blocks with the id example for store 1 and store 2. I then went to add a 3rd block to store 2 with the id example and the system lets me do this. My thinking is that the validation should check to make sure you are not adding the same block twice to the same store. |
@@ -183,7 +183,7 @@ public function getIsUniqueBlockToStores(AbstractModel $object) | |||
$entityMetadata = $this->metadataPool->getMetadata(BlockInterface::class); | |||
$linkField = $entityMetadata->getLinkField(); | |||
|
|||
if ($this->_storeManager->hasSingleStore()) { | |||
if ($this->_storeManager->isSingleStoreMode()) { | |||
$stores = [Store::DEFAULT_STORE_ID]; | |||
} else { | |||
$stores = (array)$object->getData('stores'); |
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.
The store validation seems to be broken here as the data set on the object is under store_id
and not stores
.
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.
Or maybe better still would be to use the getStores
method that is against the Block model.
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.
Store validation seems to not work anyway.
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.
The validation issue I raised has been solved in #11802
Yes is my teamate @thiagolima-bm , What que do? |
@osrecio nothing to do now with this pr. We will process both of them to improve/fix the cms block admin experience. Thank you for your code. |
Solved this PR in /pull/11802 |
Changed validation to
getIsUniqueBlockToStores
Description
Changed validation to get
DEFAULT_STORE_ID
when the app is setted withSingleStoreMode
in the other cases get store from objectFixed Issues (if relevant)
Manual testing scenarios
no
Contribution checklist