var el = document.querySelector('form');
el.addEventListener("submit", function(e) {
e.preventDefault();
//.....
function(token) {
$('.g_recaptcha_response').val(token);
el.submit();
array_merge($this->globalFilter, $this->filterFields)
namespace Ulrusy\Log;
\Bitrix\Main\Loader::includeModule('ulrusy.log');
echo class_exists('имя_класса_с_namespace');
$eventManager = \Bitrix\Main\EventManager::getInstance();
$events = $eventManager->findEventHandlers('iblock', 'OnAfterIBlockElementAdd');
print_r($events);
class MyClass
{
// создаем обработчик события "OnAfterIBlockElementAdd"
function OnAfterIBlockElementAddHandler3(&$arFields)
{
file_put_contents($_SERVER['DOCUMENT_ROOT'].'/log_dev.txt', FILE.':'.LINE.PHP_EOL.print_r($arFields, true)."\n", FILE_APPEND);
}
}
use \Bitrix\Main\UserField\Types\StringType;
$eventManager = \Bitrix\Main\EventManager::getInstance();
$eventManager->addEventHandler('main', 'OnUserTypeBuildList', ['VarcharUserField', 'getUserTypeDescription']);
$eventManager->addEventHandler('main', 'OnBeforeUserTypeAdd', ['VarcharUserField', 'onBeforeAdd']);
class VarcharUserField extends StringType
{
const USER_TYPE_ID = 'varchar';
const USER_TYPE_ID_STRING = StringType::USER_TYPE_ID;
private static $maxLength = 255;
public static function getDescription(): array
{
return [
// заголовок для выбора в админке, при создании свойства hl
'DESCRIPTION' => 'Varchar',
'BASE_TYPE' => \CUserTypeManager::BASE_TYPE_STRING,
];
}
public static function getDbColumnType(): string
{
return 'varchar('.static::$maxLength.')';
}
public static function onBeforeAdd(&$fields)
{
$settings = unserialize($fields['SETTINGS']);
// если выбрана строка, но поле MAX_LENGTH (Максимальная длина строки) <= 255, меняем тип на varchar
if($fields['USER_TYPE_ID'] == static::USER_TYPE_ID_STRING) {
if(self::isVarcharLength($settings)) {
$fields['USER_TYPE_ID'] = static::USER_TYPE_ID;
}
}
if($fields['USER_TYPE_ID'] == static::USER_TYPE_ID) {
if(self::isVarcharLength($settings)) {
static::$maxLength = $settings['MAX_LENGTH'];
}
}
}
private static function isVarcharLength($settings)
{
return isset($settings['MAX_LENGTH']) && $settings['MAX_LENGTH'] <= 255;
}
}