Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/11.1' into 11.x
Browse files Browse the repository at this point in the history
  • Loading branch information
kingjia90 committed Dec 21, 2023
2 parents 95d96df + 28c2112 commit 75b854f
Show file tree
Hide file tree
Showing 11 changed files with 62 additions and 20 deletions.
5 changes: 5 additions & 0 deletions bundles/CoreBundle/config/pimcore/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -329,3 +329,8 @@ pimcore:

gotenberg:
base_url: 'http://gotenberg:3000'

config_location:
select_options:
read_target:
type: 'symfony-config'
9 changes: 7 additions & 2 deletions bundles/CoreBundle/src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,6 @@ public function getConfigTreeBuilder(): TreeBuilder
'perspectives' => PIMCORE_CONFIGURATION_DIRECTORY . '/perspectives',
'custom_views' => PIMCORE_CONFIGURATION_DIRECTORY . '/custom_views',
'object_custom_layouts' => PIMCORE_CONFIGURATION_DIRECTORY . '/object_custom_layouts',
'system_settings' => PIMCORE_CONFIGURATION_DIRECTORY . '/system_settings',
'select_options' => PIMCORE_CONFIGURATION_DIRECTORY . '/select_options',
]);

ConfigurationHelper::addConfigLocationTargetNode(
Expand All @@ -149,6 +147,13 @@ public function getConfigTreeBuilder(): TreeBuilder
[LocationAwareConfigRepository::READ_TARGET]
);

ConfigurationHelper::addConfigLocationTargetNode(
$storageNode,
'select_options',
PIMCORE_CONFIGURATION_DIRECTORY . '/select_options',
[LocationAwareConfigRepository::READ_TARGET]
);

return $treeBuilder;
}

Expand Down
4 changes: 2 additions & 2 deletions bundles/TinymceBundle/public/js/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ pimcore.bundle.tinymce.editor = Class.create({
document.dispatchEvent(new CustomEvent(pimcore.events.changeWysiwyg, {
detail: {
e: eChange,
data: tinymce.activeEditor.contentAreaContainer.innerHTML,
data: tinymce.activeEditor.getContent(),
context: e.detail.context
}
}));
Expand All @@ -115,7 +115,7 @@ pimcore.bundle.tinymce.editor = Class.create({
document.dispatchEvent(new CustomEvent(pimcore.events.changeWysiwyg, {
detail: {
e: eChange,
data: tinymce.activeEditor.contentAreaContainer.innerHTML,
data: tinymce.activeEditor.getContent(),
context: e.detail.context
}
}));
Expand Down
2 changes: 1 addition & 1 deletion doc/03_Documents/01_Editables/40_WYSIWYG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ The Editor als needs to dispatch the `pimcore.events.changeWysiwyg` to set the v
document.dispatchEvent(new CustomEvent(pimcore.events.changeWysiwyg, {
detail: {
e: eChange,
data: tinymce.activeEditor.contentAreaContainer.innerHTML, //text of the editor-field
data: tinymce.activeEditor.getContent(), //text of the editor-field
context: e.detail.context //the context in which the editor is registered (object, document ...)
}
}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ with details about calculated-value field is affected and where it is located at

```php
namespace App;


use Pimcore\Logger;
use Pimcore\Model\DataObject\Concrete;
use Pimcore\Model\DataObject\ClassDefinition\CalculatorClassInterface;
use Pimcore\Model\DataObject\Data\CalculatedValue;
Expand All @@ -88,9 +89,10 @@ class Calculator implements CalculatorClassInterface
{
if ($context->getFieldname() == "sum") {
$language = $context->getPosition();
return $object->getXValue($language) + $object->getYValue($language);
return $object->getXValue($language) + $object->getYValue($language);
} else {
\Logger::error("unknown field");
Logger::error("unknown field");
return '';
}
}
}
Expand All @@ -102,7 +104,8 @@ In addition to the `compute` method you need to implement the `getCalculatedValu
This method is used to display the value in object edit mode:

```php
public function getCalculatedValueForEditMode(Concrete $object, CalculatedValue $context): string {
public function getCalculatedValueForEditMode(Concrete $object, CalculatedValue $context): string
{
$language = $context->getPosition();
$result = $object->getXValue($language) . " + " . $object->getYValue($language) . " = " . $this->compute($object, $context);
return $result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,20 @@ If you are not using Web2Print functionality, set the flag to false.
### WYSIWYG-Editor
Please add all html tags with attributes you want to allow to the html_sanitizer like described [here](../../03_Documents/01_Editables/40_WYSIWYG.md)

### Redis Cache Configuration
If you are using `Redis` adapter for `Pimcore\Cache` then adapt the configuration as below:
```yaml
framework:
cache:
pools:
pimcore.cache.pool:
#tags: true // this line needs to be removed
public: true
default_lifetime: 31536000 # 1 year
adapter: cache.adapter.redis_tag_aware # use this instead of pimcore.cache.adapter.redis_tag_aware
...
```

## Update Pimcore via Composer

Update Pimcore to Pimcore 11 via composer statement `composer require -W pimcore/pimcore:^11.0 pimcore/admin-ui-classic-bundle`.
Expand Down
5 changes: 5 additions & 0 deletions lib/Mail/Mailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
use Pimcore\Mail\Plugins\RedirectingPlugin;
use Symfony\Component\Mailer\Envelope;
use Symfony\Component\Mailer\MailerInterface;
use Symfony\Component\Mime\Message;
use Symfony\Component\Mime\RawMessage;

class Mailer implements MailerInterface
Expand All @@ -40,6 +41,10 @@ public function send(RawMessage $message, Envelope $envelope = null): void
$this->redirectPlugin->beforeSendPerformed($message);
}

if($message instanceof Message && !$message->getHeaders()->has('X-Transport')) {
$message->getHeaders()->addTextHeader('X-Transport', 'main');
}

$this->mailer->send($message, $envelope);

if ($message instanceof Mail) {
Expand Down
23 changes: 16 additions & 7 deletions lib/Tool/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ public static function getLanguages(): array
{
$baseResource = \Pimcore::getContainer()->getParameter('pimcore_admin.translations.path');
$languageDir = \Pimcore::getKernel()->locateResource($baseResource);
$adminLang = \Pimcore::getContainer()->getParameter('pimcore_admin.admin_languages');
$adminLanguages = \Pimcore::getContainer()->getParameter('pimcore_admin.admin_languages');
$appDefaultPath = \Pimcore::getContainer()->getParameter('translator.default_path');

$languages = [];
$languageDirs = [$languageDir, $appDefaultPath];
$translatedLanguages = [];
foreach ($languageDirs as $filesDir) {
if (is_dir($filesDir)) {
$files = scandir($filesDir);
Expand All @@ -57,18 +57,27 @@ public static function getLanguages(): array
$languageCode = $parts[1];
}

if (($adminLang != null && in_array($languageCode, array_values($adminLang))) || $adminLang == null) {
if ($parts[1] === 'json' || $parts[0] === 'admin') {
if (\Pimcore::getContainer()->get(LocaleServiceInterface::class)->isLocale($languageCode)) {
$languages[] = $languageCode;
}
if ($parts[1] === 'json' || $parts[0] === 'admin') {
if (\Pimcore::getContainer()->get(LocaleServiceInterface::class)->isLocale($languageCode)) {
$translatedLanguages[] = $languageCode;
}
}
}
}
}
}

$languages = [];
foreach ($adminLanguages as $adminLanguage) {
if (in_array($adminLanguage, $translatedLanguages, true) || in_array(\Locale::getPrimaryLanguage($adminLanguage), $translatedLanguages, true)) {
$languages[] = $adminLanguage;
}
}

if (empty($languages)) {
$languages = $translatedLanguages;
}

return array_unique($languages);
}

Expand Down
2 changes: 1 addition & 1 deletion models/Asset/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ public static function getImageThumbnailByArrayConfig(array $config): null|Thumb

//check if high res image is called

preg_match("@([^\@]+)(\@[0-9.]+x)?\.([^\.]+)\.([a-zA-Z]{2,5})@", $config['filename'], $matches);
preg_match("@([^\@]+)(\@[0-9.]+x)?\.?([^\.]+)?\.([a-zA-Z]{2,5})@", $config['filename'], $matches);

if (empty($matches) || !isset($matches[1])) {
return null;
Expand Down
1 change: 1 addition & 0 deletions models/DataObject/Data/QuantityValueRange.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public function toArray(): array
return [
'minimum' => $this->getMinimum(),
'maximum' => $this->getMaximum(),
'unitId' => $this->getUnitId(),
];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ public function isEqual(mixed $oldValue, mixed $newValue): bool
return !$container1 && !$container2;
}

/** @var ElementInterface $el1 */
/** @var ElementInterface|null $el1 */
$el1 = $container1->getElement();
/** @var ElementInterface $el2 */
/** @var ElementInterface|null $el2 */
$el2 = $container2->getElement();

if (! ($el1->getType() == $el2->getType() && ($el1->getId() == $el2->getId()))) {
if (! ($el1?->getType() == $el2?->getType() && ($el1?->getId() == $el2?->getId()))) {
return false;
}

Expand Down

0 comments on commit 75b854f

Please sign in to comment.