-
-
Notifications
You must be signed in to change notification settings - Fork 159
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
FIX: localized fields from brick and fieldcollections can be added to index #1872
Merged
Merged
Changes from 14 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
0510142
FIX:double click on field group adds them to indices
BabovicT fbc2882
FIX: added localized fields from brick and fieldcollections can be ad…
BabovicT a26517a
Fixed localized field collections indexes
BabovicT 495072d
Fixed localized field collections indexes
BabovicT 1662dd4
Update psalm.xml
dpfaffenbauer 8fda261
Merge pull request #1871 from BabovicT/patch-2
dpfaffenbauer 81beabe
Merge pull request #1873 from coreshop/dpfaffenbauer-patch-1
dpfaffenbauer c065766
FIX: added localized fields from brick and fieldcollections can be ad…
BabovicT d905174
Fixed localized field collections indexes
BabovicT f97efda
Fixed localized field collections indexes
BabovicT 1d60bfb
Refactor fieldCollectionGetter and localizedFieldGetter
BabovicT 6969dcb
Merge branch 'patch-3' of github.com:BabovicT/CoreShop into patch-3
BabovicT affe8c4
Refactor fieldCollectionGetter and localizedFieldGetter
BabovicT c451aba
[Index] getter with localized fields
dpfaffenbauer 1361bb2
[IndexBundle] support localized FieldCollection
dpfaffenbauer 40e79c4
[IndexBundle] support localized FieldCollection - fd can be null
dpfaffenbauer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/CoreShop/Component/Pimcore/DataObject/LocaleFallbackHelper.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
/** | ||
* CoreShop. | ||
* | ||
* This source file is subject to the GNU General Public License version 3 (GPLv3) | ||
* For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt | ||
* files that are distributed with this source code. | ||
* | ||
* @copyright Copyright (c) CoreShop GmbH (https://www.coreshop.org) | ||
* @license https://www.coreshop.org/license GNU General Public License version 3 (GPLv3) | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace CoreShop\Component\Pimcore\DataObject; | ||
|
||
use Pimcore\Model\DataObject; | ||
|
||
class LocaleFallbackHelper | ||
{ | ||
/** | ||
* This function enables usage of locale fallback in Pimcore and resets the state of locale fallback automatically | ||
* after your functions is finished. | ||
*/ | ||
public static function useFallbackValues(\Closure $function, bool $useFallback = true): mixed | ||
{ | ||
$backup = DataObject\Localizedfield::getGetFallbackValues(); | ||
DataObject\Localizedfield::setGetFallbackValues($useFallback); | ||
|
||
$result = $function(); | ||
|
||
DataObject\Localizedfield::setGetFallbackValues($backup); | ||
|
||
return $result; | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@dpfaffenbauer I think it would work but $fd is not instance of LocalizedField. It is instance of field under the localizedfields. Thats why I used
if ($item->getDefinition()->getFieldDefinition('localizedfields')) {
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.
but that only checks if there are localized-fields in the fieldcollection... which is useless basically. We need to know if the selected field is localized or not. But I see that there is an issue here. I will check again.
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.
For some reason that checks if that field is inside localized-fields. If you have input and localized input that will be true only for localized input. Not sure why is that the case tho.
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.
changed some more, worked for me now.