Skip to content

Commit f784962

Browse files
committed
Merge branch 'master' into test-links
2 parents 0bf03af + d2a2bb8 commit f784962

File tree

360 files changed

+7704
-2237
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

360 files changed

+7704
-2237
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
<!-- vale off -->
2+
13
# Ibexa DXP Developer Documentation
24

35
This repository is the source for the [developer documentation for Ibexa](https://doc.ibexa.co/en/latest),

code_samples/api/commerce/src/Command/CartCommand.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,5 +135,18 @@ protected function execute(InputInterface $input, OutputInterface $output): int
135135
$this->cartService->deleteCart($cart);
136136

137137
return self::SUCCESS;
138+
139+
// Get the order with items that should be reordered
140+
$order = $this->orderService->getOrderByIdentifier($orderIdentifier);
141+
142+
// Get the cart to merge
143+
$existingCart = $this->cartResolver->resolveCart();
144+
145+
$reorderCart = $this
146+
->reorderService
147+
->addToCartFromOrder($order, $this->reorderService->createReorderCart($order));
148+
149+
// Merge the carts into the target cart and delete the merged carts
150+
$reorderCart = $this->cartService->mergeCarts($reorderCart, true, $existingCart);
138151
}
139152
}

code_samples/api/product_catalog/src/Command/ProductPriceCommand.php

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,15 @@
55
use Ibexa\Contracts\Core\Repository\PermissionResolver;
66
use Ibexa\Contracts\Core\Repository\UserService;
77
use Ibexa\Contracts\ProductCatalog\CurrencyServiceInterface;
8+
use Ibexa\Contracts\ProductCatalog\PriceResolverInterface;
89
use Ibexa\Contracts\ProductCatalog\ProductPriceServiceInterface;
910
use Ibexa\Contracts\ProductCatalog\ProductServiceInterface;
1011
use Ibexa\Contracts\ProductCatalog\Values\Price\Create\Struct\ProductPriceCreateStruct;
12+
use Ibexa\Contracts\ProductCatalog\Values\Price\PriceContext;
13+
use Ibexa\Contracts\ProductCatalog\Values\Price\PriceQuery;
14+
use Ibexa\Contracts\ProductCatalog\Values\Price\Query\Criterion\Currency;
15+
use Ibexa\Contracts\ProductCatalog\Values\Price\Query\Criterion\CustomerGroup;
16+
use Ibexa\Contracts\ProductCatalog\Values\Price\Query\Criterion\Product;
1117
use Money;
1218
use Symfony\Component\Console\Command\Command;
1319
use Symfony\Component\Console\Input\InputArgument;
@@ -18,6 +24,8 @@ final class ProductPriceCommand extends Command
1824
{
1925
private ProductPriceServiceInterface $productPriceService;
2026

27+
private PriceResolverInterface $priceResolver;
28+
2129
private ProductServiceInterface $productService;
2230

2331
private CurrencyServiceInterface $currencyService;
@@ -26,10 +34,17 @@ final class ProductPriceCommand extends Command
2634

2735
private PermissionResolver $permissionResolver;
2836

29-
public function __construct(CurrencyServiceInterface $currencyService, ProductServiceInterface $productService, ProductPriceServiceInterface $productPriceService, UserService $userService, PermissionResolver $permissionResolver)
30-
{
37+
public function __construct(
38+
CurrencyServiceInterface $currencyService,
39+
ProductServiceInterface $productService,
40+
ProductPriceServiceInterface $productPriceService,
41+
PriceResolverInterface $priceResolver,
42+
UserService $userService,
43+
PermissionResolver $permissionResolver
44+
) {
3145
$this->currencyService = $currencyService;
3246
$this->productPriceService = $productPriceService;
47+
$this->priceResolver = $priceResolver;
3348
$this->productService = $productService;
3449
$this->userService = $userService;
3550
$this->permissionResolver = $permissionResolver;
@@ -82,6 +97,22 @@ protected function execute(InputInterface $input, OutputInterface $output): int
8297
$output->writeln($price);
8398
}
8499

100+
$priceCriteria = [
101+
new Currency('USD'),
102+
new CustomerGroup('customer_group_1'),
103+
new Product('ergo_desk'),
104+
];
105+
106+
$priceQuery = new PriceQuery(new LogicalOr(...$priceCriteria));
107+
$prices = $this->priceService->findPrices($priceQuery);
108+
109+
$output->writeln(sprintf('Found %d prices with provided criteria', count($prices)));
110+
111+
$context = new PriceContext($currency);
112+
$price = $this->priceResolver->resolvePrice($product, $context);
113+
114+
$output->writeln('Price in ' . $currency->getCode() . ' for ' . $product->getName() . ' is ' . $price);
115+
85116
return self::SUCCESS;
86117
}
87118
}

code_samples/api/public_php_api/src/Command/TaxonomyCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ public function execute(InputInterface $input, OutputInterface $output)
3939
$user = $this->userService->loadUserByLogin('admin');
4040
$this->permissionResolver->setCurrentUserReference($user);
4141

42-
$allEntries = $this->taxonomyService->loadAllEntries('tags', 30, 0);
42+
$allEntries = $this->taxonomyService->loadAllEntries(null, 50);
4343

4444
$entry = $this->taxonomyService->loadEntryByIdentifier('desks');
4545

4646
$output->writeln($entry->name . ' with parent ' . $entry->parent->name);
4747

4848
// Loads first 10 children
49-
$entryChildren = $this->taxonomyService->loadEntryChildren($entry, 10, 0);
49+
$entryChildren = $this->taxonomyService->loadEntryChildren($entry, 10);
5050

5151
foreach ($entryChildren as $child) {
5252
$output->writeln($child->name);

code_samples/back_office/calendar/config/custom_services.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ services:
1010
$eventType: '@App\Calendar\Holidays\EventType'
1111

1212
App\Calendar\Holidays\EventSource:
13-
class: Ibexa\Tests\Calendar\Calendar\EventSource
14-
factory: [ '@App\Calendar\Holidays\EventSourceFactory','createEventSource' ]
13+
class: Ibexa\Calendar\EventSource\InMemoryEventSource
14+
factory: [ '@App\Calendar\Holidays\EventSourceFactory', 'createEventSource' ]
1515
tags:
1616
- { name: ibexa.calendar.event.source }
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
-
2+
type: role
3+
mode: delete
4+
match:
5+
field: identifier
6+
value: Contributor
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
-
2+
type: role
3+
mode: update
4+
match:
5+
field: identifier
6+
value: Editor
7+
policies:
8+
- module: content
9+
function: '*'
10+
- module: user
11+
function: login
12+
limitations:
13+
- identifier: SiteAccess
14+
values: [ admin ]
15+
- module: url
16+
function: '*'
17+
18+
-
19+
type: role
20+
mode: update
21+
match:
22+
field: identifier
23+
value: Anonymous
24+
policies:
25+
mode: append
26+
list:
27+
-
28+
module: user
29+
function: login
30+
limitations:
31+
- identifier: SiteAccess
32+
values: [ new_siteaccess ]

code_samples/forms/custom_form_attribute/config/custom_services.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
$fieldIdentifier: checkbox_with_richtext_description
44
$formType: 'App\FormBuilder\Form\Type\CheckboxWithRichtextDescriptionType'
55
tags:
6-
- { name: ibexa.form_builder.field_mapper }
6+
- { name: ibexa.form_builder.field.mapper }
77

88
ibexa.form_builder.attribute_form_type_mapper.richtext_description:
99
class: Ibexa\FormBuilder\Form\Mapper\FieldAttribute\GenericFieldAttributeTypeMapper
Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,28 @@
1-
(function(global, doc, ibexa) {
2-
const richtext = new ibexa.BaseRichText();
1+
(function (global, doc, ibexa) {
2+
global.addEventListener('load', (event) => {
3+
const richtext = new ibexa.BaseRichText();
34

4-
// Enable editor in all ibexa-data-source divs
5-
doc.querySelectorAll('.ibexa-data-source').forEach((ibexaDataSource) => {
6-
const richtextContainer = ibexaDataSource.querySelector(".ibexa-data-source__richtext");
7-
const alloyEditor = richtext.init(richtextContainer);
5+
// Enable editor in all ibexa-data-source divs
6+
doc.querySelectorAll('.ibexa-data-source').forEach(
7+
(ibexaDataSource) => {
8+
const richtextContainer = ibexaDataSource.querySelector(
9+
'.ibexa-data-source__richtext'
10+
);
11+
12+
if (richtextContainer.classList.contains('ck')) {
13+
return;
14+
}
15+
16+
richtext.init(richtextContainer);
17+
}
18+
);
819
});
20+
21+
const openUdw = (config) => {
22+
const openUdwEvent = new CustomEvent('ibexa-open-udw', { detail: config });
23+
24+
doc.body.dispatchEvent(openUdwEvent);
25+
};
26+
27+
ibexa.addConfig('richText.alloyEditor.callbacks.selectContent', openUdw);
928
})(window, window.document, window.ibexa);

code_samples/forms/custom_form_attribute/src/FormBuilder/Form/Type/CheckboxWithRichtextDescriptionType.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ public function buildView(FormView $view, FormInterface $form, array $options):
3838
{
3939
// pass the Dom object of the richtext doc to the template
4040
$dom = new \DOMDocument();
41-
$dom->loadXML($options['richtext_description']);
41+
if (!empty($options['richtext_description'])) {
42+
$dom->loadXML($options['richtext_description']);
43+
}
4244
$view->vars['richtextDescription'] = $dom;
4345
}
4446
}

0 commit comments

Comments
 (0)