function viewType($array, $cuurrentSecId){
$eventManager = \Bitrix\Main\EventManager::getInstance();
$eventManager->addEventHandler('sender', '\Bitrix\Sender\Contact::OnAdd', ['\SenderHandlers', 'OnAddContact']);
class SenderHandlers {
public static function OnAddContact($event) {
}
}
<span class="btn js-offer-request" data-fancybox_ajax_form data-src="<?=$this->getFolder().'/ajax_form.php';?>" data-on_name="<?=$arItem['NAME'];?>" data-element_id="<?=$arItem['ID'];?>">
<span>Забронировать экскурсию</span>
</span>
var getNodeData = function(element, arrayKeysUnset) {
var nodeData = $(element).clone().data();
if(arrayKeysUnset && arrayKeysUnset.length) {
for(var key of arrayKeysUnset) {
delete nodeData[key];
}
}
for(var key in nodeData) {
nodeData[key] = encodeURIComponent(nodeData[key]);
}
return nodeData;
}
$(document).on('click', '[data-fancybox_ajax_form]', function() {
$.fancybox.open(this, {
type: 'ajax',
ajax: {
settings: {
data: getNodeData(this, ['src', 'fancybox_ajax_form'])
}
}
});
});
<?
require_once($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/main/include/prolog_before.php');
$request = \Bitrix\Main\Application::getInstance()->getContext()->getRequest();
$requestValues = $request->getValues();
if(isset($requestValues['fancybox']))
unset($requestValues['fancybox']);
// добавление параметров для компонента, из data атрибутов кнопки
$parameters = [];
if($requestValues) {
foreach($requestValues as $key => $value) {
$value = urldecode($value);
if(defined('LANG_CHARSET') && LANG_CHARSET == 'windows-1251')
$value = \Bitrix\Main\Text\Encoding::convertEncoding($value, 'utf-8', 'windows-1251');
$parameters[strtoupper($key)] = $value;
}
}
// здесь подключаешь свой компонент формы
$APPLICATION->IncludeComponent(
"bitrix:main.feedback",
"bootstrap_v4",
array(
// у тебя нет этих параметров, указал для примера, оставь пустой массив
"EMAIL_TO" => "sale@nyuta.bx",
"EVENT_MESSAGE_ID" => array(),
"OK_TEXT" => "Спасибо, ваше сообщение принято.",
"REQUIRED_FIELDS" => array("NAME","EMAIL"),
"USE_CAPTCHA" => "Y",
'AJAX_MODE' => 'Y',
) + $parameters
);
<?foreach($arResult['ITEMS'] as $arItem):?>
<?
$popupId = randString(10, ['abcdefghijklmnop']);
?>
<?//............................?>
<a href="javascript:;" class="btn js-offer-request" data-fancybox="" data-src="#individual-tour-form_<?=$popupId;?>">
<span>Забронировать экскурсию</span>
</a>
<?//............................?>
<?endforeach;?>
"POPUP_ID" => $popupId
<?
$popupId = isset($arParams['POPUP_ID']) && $arParams['POPUP_ID'] ? '_'.$arParams['POPUP_ID'] : '';
?>
<div class="form-modal" id="individual-tour-form<?=$popupId;?>">