Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
composition.php
1<?php
2
4
9use \Bitrix\Socialnetwork\Space\Toolbar;
10
12{
13 private int $userId;
14
18 public function getAutoWiredParameters(): array
19 {
20 return [
22 Toolbar\Composition::class,
23 'composition',
24 fn ($className, $composition): Toolbar\Composition => new $className($this->userId, $composition),
25 ),
26 ];
27 }
28
32 public function setSettingsAction(Toolbar\Composition $composition, array $settings = []): ?array
33 {
34 $result = $composition->setSettings($settings);
35 if (!$result->isSuccess())
36 {
37 $this->addErrors($result->getErrors());
38 return null;
39 }
40
41 return [
42 'settings' => $composition->getSettings(false),
43 ];
44 }
45
49 public function getSettingsAction(Toolbar\Composition $composition): ?array
50 {
51 return [
52 'settings' => $composition->getSettings(false),
53 ];
54 }
55
56 protected function init(): void
57 {
58 parent::init();
59 $this->userId = CurrentUser::get()->getId();
60 }
61}
setSettingsAction(Toolbar\Composition $composition, array $settings=[])