Skip to content

Commit

Permalink
Merge branch '11.1' into 11.x
Browse files Browse the repository at this point in the history
  • Loading branch information
dvesh3 committed Nov 22, 2023
2 parents 74c1537 + 9df9a13 commit 584f85b
Show file tree
Hide file tree
Showing 12 changed files with 38 additions and 27 deletions.
8 changes: 0 additions & 8 deletions .github/PULL_REQUEST_TEMPLATE.md
Expand Up @@ -20,11 +20,3 @@ Before working on a contribution, you must determine on which branch you need to
Resolves #

## Additional info

### WHAT
copilot:summary

copilot:poem

### HOW
copilot:walkthrough
5 changes: 2 additions & 3 deletions composer.json
Expand Up @@ -131,7 +131,6 @@
},
"conflict": {
"symfony/symfony": "*",
"doctrine/doctrine-migrations-bundle": "3.1.0",
"sabre/dav": "4.2.2",
"thecodingmachine/safe": "<2.0"
},
Expand All @@ -140,8 +139,8 @@
"codeception/module-symfony": "^3.1.0",
"codeception/phpunit-wrapper": "^9",
"ergebnis/phpstan-rules": "^2.0",
"phpstan/phpstan": "1.10.39",
"phpstan/phpstan-symfony": "^1.3.2",
"phpstan/phpstan": "1.10.43",
"phpstan/phpstan-symfony": "^1.3.5",
"phpunit/phpunit": "^9.3",
"gotenberg/gotenberg-php": "^1.1",
"composer/composer": "*",
Expand Down
5 changes: 5 additions & 0 deletions lib/Console/Application.php
Expand Up @@ -25,6 +25,7 @@
use Pimcore\Tool\MaintenanceModeHelperInterface;
use Pimcore\Version;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Command\LazyCommand;
use Symfony\Component\Console\ConsoleEvents;
use Symfony\Component\Console\Event\ConsoleCommandEvent;
use Symfony\Component\Console\Event\ConsoleTerminateEvent;
Expand Down Expand Up @@ -122,6 +123,10 @@ protected function getDefaultInputDefinition(): InputDefinition

public function add(Command $command): ?Command
{
if ($command instanceof LazyCommand && str_starts_with($command->getName(), 'doctrine:')) {
$command = $command->getCommand();
}

if ($command instanceof DoctrineCommand) {
$definition = $command->getDefinition();

Expand Down
6 changes: 3 additions & 3 deletions lib/Document/Renderer/DocumentRenderer.php
Expand Up @@ -20,7 +20,7 @@
use Pimcore\Event\DocumentEvents;
use Pimcore\Event\Model\DocumentEvent;
use Pimcore\Http\RequestHelper;
use Pimcore\Localization\LocaleService;
use Pimcore\Localization\LocaleServiceInterface;
use Pimcore\Model\Document;
use Pimcore\Routing\Dynamic\DocumentRouteHandler;
use Pimcore\Templating\Renderer\ActionRenderer;
Expand All @@ -43,15 +43,15 @@ class DocumentRenderer implements DocumentRendererInterface

private EventDispatcherInterface $eventDispatcher;

private LocaleService $localeService;
private LocaleServiceInterface $localeService;

public function __construct(
RequestHelper $requestHelper,
ActionRenderer $actionRenderer,
FragmentRendererInterface $fragmentRenderer,
DocumentRouteHandler $documentRouteHandler,
EventDispatcherInterface $eventDispatcher,
LocaleService $localeService
LocaleServiceInterface $localeService
) {
$this->requestHelper = $requestHelper;
$this->actionRenderer = $actionRenderer;
Expand Down
2 changes: 1 addition & 1 deletion lib/Navigation/Renderer/AbstractRenderer.php
Expand Up @@ -230,7 +230,7 @@ public function findActive(Container $container, int $minDepth = null, int $maxD
}
}

if ($foundDepth > $maxDepth) {
if (is_int($maxDepth) && $foundDepth > $maxDepth) {
while ($foundDepth > $maxDepth) {
if (--$foundDepth < $minDepth) {
$found = null;
Expand Down
2 changes: 1 addition & 1 deletion models/Asset/MetaData/EmbeddedMetaDataTrait.php
Expand Up @@ -354,7 +354,7 @@ public function getIPTCData(?string $filePath = null): array
$iptcRaw = iptcparse($info['APP13']);
if (is_array($iptcRaw)) {
foreach ($iptcRaw as $key => $value) {
if (is_array($value) && count($value) === 1) {
if (count($value) === 1) {
$value = $value[0];
}

Expand Down
3 changes: 2 additions & 1 deletion models/DataObject/ClassDefinition/Data/Block.php
Expand Up @@ -294,6 +294,7 @@ public function getDataFromEditmode(mixed $data, DataObject\Concrete $object = n
{
$result = [];
$count = 0;
$context = $params['context'] ?? [];

foreach ($data as $rawBlockElement) {
$resultElement = [];
Expand All @@ -307,7 +308,7 @@ public function getDataFromEditmode(mixed $data, DataObject\Concrete $object = n
$invisible = $fd->getInvisible();
if ($invisible && !is_null($oIndex)) {
$blockGetter = 'get' . ucfirst($this->getname());
if (method_exists($object, $blockGetter)) {
if (empty($context['containerType']) && method_exists($object, $blockGetter)) {
$language = $params['language'] ?? null;
$items = $object->$blockGetter($language);
if (isset($items[$oIndex])) {
Expand Down
12 changes: 10 additions & 2 deletions models/DataObject/ClassDefinition/Data/Wysiwyg.php
Expand Up @@ -98,7 +98,11 @@ public function getDataForResource(mixed $data, DataObject\Concrete $object = nu
$data = self::getWysiwygSanitizer()->sanitizeFor('body', $data);
}

return Text::wysiwygText($data);
return Text::wysiwygText($data, [
'object' => $params['owner'] ?? null,
'context' => $this,
'language' => $params['language'] ?? null,
]);
}

/**
Expand All @@ -108,7 +112,11 @@ public function getDataForResource(mixed $data, DataObject\Concrete $object = nu
*/
public function getDataFromResource(mixed $data, DataObject\Concrete $object = null, array $params = []): ?string
{
return Text::wysiwygText($data);
return Text::wysiwygText($data, [
'object' => $params['owner'] ?? null,
'context' => $this,
'language' => $params['language'] ?? null,
]);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion models/DataObject/Data/Link.php
Expand Up @@ -421,7 +421,7 @@ public function getHtml(): string

public function isEmpty(): bool
{
$vars = get_object_vars($this);
$vars = $this->getObjectVars();
foreach ($vars as $value) {
if (!empty($value)) {
return false;
Expand Down
6 changes: 6 additions & 0 deletions models/DataObject/Service.php
Expand Up @@ -1363,6 +1363,12 @@ public static function enrichLayoutDefinition(ClassDefinition\Data|ClassDefiniti
if (method_exists($layout, 'getChildren')) {
$children = $layout->getChildren();
if (is_array($children)) {
// Send information when we have block or similar element
if ($layout instanceof \Pimcore\Model\DataObject\ClassDefinition\Data && empty($context['subContainerType'])) {
$context['subContainerKey'] = $layout->getName();
$context['subContainerType'] = $layout->getFieldtype();
}

foreach ($children as $child) {
self::enrichLayoutDefinition($child, $object, $context);
}
Expand Down
4 changes: 2 additions & 2 deletions models/Document/Editable/Video.php
Expand Up @@ -508,7 +508,7 @@ private function getErrorCode(string $message = ''): string
$width = $this->getWidth();
// If contains at least one digit (0-9), then assume it is a value that can be calculated,
// otherwise it is likely be `auto`,`inherit`,etc..
if (preg_match('/[\d]/', $width)) {
if (preg_match('/[\d]/', (string) $width)) {
// when is numeric, assume there are no length units nor %, and considering the value as pixels
if (is_numeric($width)) {
$width .= 'px';
Expand All @@ -517,7 +517,7 @@ private function getErrorCode(string $message = ''): string
}

$height = $this->getHeight();
if (preg_match('/[\d]/', $height)) {
if (preg_match('/[\d]/', (string) $height)) {
if (is_numeric($height)) {
$height .= 'px';
}
Expand Down
10 changes: 5 additions & 5 deletions models/User.php
Expand Up @@ -593,11 +593,11 @@ private function getMergedWebsiteTranslationLanguagesEdit(): array
public function getAllowedLanguagesForEditingWebsiteTranslations(): ?array
{
$mergedWebsiteTranslationLanguagesEdit = $this->getMergedWebsiteTranslationLanguagesEdit();
if (empty($mergedWebsiteTranslationLanguagesEdit) || $this->isAdmin()) {
$mergedWebsiteTranslationLanguagesView = $this->getMergedWebsiteTranslationLanguagesView();
if (empty($mergedWebsiteTranslationLanguagesView)) {
return Tool::getValidLanguages();
}
if (
(!$mergedWebsiteTranslationLanguagesEdit && !$this->getMergedWebsiteTranslationLanguagesView()) ||
$this->isAdmin()
) {
return Tool::getValidLanguages();
}

return $mergedWebsiteTranslationLanguagesEdit;
Expand Down

0 comments on commit 584f85b

Please sign in to comment.