1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
contentjson.php
См. документацию.
1<?php
8namespace Bitrix\Sender\Internals\QueryController;
9
10use Bitrix\Main\Localization\Loc;
11use Bitrix\Main\Web\Json;
12
13Loc::loadMessages(__FILE__);
14
19class ContentJson extends Content
20{
21 protected $parameters = array();
22
23 public function set(array $parameters)
24 {
25 $this->parameters = $parameters;
26 }
27
28 public function add($name, $value)
29 {
30 $this->parameters[$name] = $value;
31 }
32
33 public function toText()
34 {
35 $default = array(
36 'error' => !$this->errors->isEmpty(),
37 'text' => implode('<br>', $this->getErrorMessages()),
38 );
39 $errorCodes = [];
40 foreach ($this->getErrorCollection() as $error)
41 {
43 if ($error->getCode())
44 $errorCodes[] = $error->getCode();
45 }
46 if ($errorCodes)
47 {
48 $default['code'] = $errorCodes[0];
49 }
50 return Json::encode($this->parameters + $default);
51 }
52
53 public function onFlush()
54 {
55 $this->response->addHeader('Content-Type', 'application/json; charset=UTF-8');
56 }
57}
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$name
Определения menu_edit.php:35
$error
Определения subscription_card_product.php:20