9namespace Bitrix\Sender\Message;
11use Bitrix\Main\ArgumentException;
13use Bitrix\Main\Localization\Loc;
14use Bitrix\Main\Result;
16Loc::getMessage(__FILE__);
72 if (!is_callable($this->view))
77 return call_user_func_array($this->view, []);
97 public function set(
$key, $value)
99 $this->data[
$key] = $value;
118 if (isset ($this->data[
$key]))
120 if ($this->data[
$key] instanceof \Closure)
122 return $this->data[
$key]();
125 return $this->data[
$key];
152 if (!empty(
$option->getItems()))
154 foreach (
$option->getItems() as $item)
156 if (!empty($value) && isset($item[
'code']) && $item[
'code'] == $value)
158 return $item[
'value'];
165 return $option->getReadonlyView($value);
179 foreach ($this->options as
$option)
197 return count($this->options) > 0;
217 return self::convertToArray($this->options);
248 if (
$option->isTemplated() && $this->hasTemplatedOption())
257 if (in_array(
$option->getType(), $uniqueTypes,
true) && $this->hasOptionsOfType(
$option->getType()))
262 if ($targetOptionCode)
264 $index = array_search($this->getOption($targetOptionCode), $this->options);
269 $this->options = array_merge(
270 array_slice($this->options, 0, $index),
272 array_slice($this->options, $index)
277 $this->options[] = $option;
287 public function setArrayOptions(array $options)
289 foreach ($options as $option)
291 $this->addOption(new ConfigurationOption($option));
300 public function getTemplatedOption()
302 foreach ($this->options as $option)
304 if ($option->isTemplated())
318 public function hasTemplatedOption()
320 return $this->getTemplatedOption() !== null;
329 public function getOptionsByGroup($group)
332 foreach ($this->options as $option)
334 if ($option->getGroup() == $group)
349 public function getOptionsByType($type)
352 foreach ($this->options as $option)
354 if ($option->getType() == $type)
369 public function getOptionByType($type)
371 return current($this->getOptionsByType($type));
380 public function hasOptionsOfType($type)
382 return count($this->getOptionsByType($type)) > 0;
390 public function checkOptions()
392 $result = new Result();
393 $this->checkRequiredOptions($result);
404 protected function checkRequiredOptions(Result $result = null)
406 if (is_null($result))
408 $result = new Result;
411 foreach ($this->getOptions() as $option)
413 if (!$option->isRequired())
418 if ($option->hasValue())
423 $result->addError(new Error(
425 'SENDER_MESSAGE_CONFIG_ERROR_EMPTY_REQUIRED_FIELD
',
426 ['%name%
' => $option->getName()]
if($_SERVER $defaultValue['REQUEST_METHOD']==="GET" &&!empty($RestoreDefaults) && $bizprocPerms==="W" &&check_bitrix_sessid())
getReadonlyView($key, $defaultValue=null)
addOption(ConfigurationOption $option, $targetOptionCode=null, $isInsertAfter=true)
__construct(array $data=[])
static convertToArray(array $options)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
if(empty($signedUserToken)) $key