• Модуль: bizproc
  • Путь к файлу: ~/bitrix/modules/bizproc/lib/basetype/select.php
  • Класс: BitrixBizprocBaseTypeSelect
  • Вызов: Select::validateValueSingle
static function validateValueSingle($value, FieldType $fieldType)
{
	$options = static::getFieldOptions($fieldType);

	if (CBPActivity::isExpression($value) || empty($options))
	{
		return $value;
	}

	if ($value === '')
	{
		return null;
	}

	if (!(is_string($value) || is_int($value)))
	{
		return null;
	}

	if (!isset($options[$value]))
	{
		$key = array_search($value, $options, false);
		if ($key === false)
		{
			static::addError([
				'code' => 'ErrorValue',
				'message' => Loc::getMessage('BPDT_SELECT_INVALID'),
			]);

			return null;
		}

		return $key;
	}

	return $value;
}