Skip to content

Instantly share code, notes, and snippets.

@d1i1m1o1n
Created May 30, 2016 11:47
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save d1i1m1o1n/093384d07724dd1ff10c64c1cbf7dcdf to your computer and use it in GitHub Desktop.
Save d1i1m1o1n/093384d07724dd1ff10c64c1cbf7dcdf to your computer and use it in GitHub Desktop.
Bitrix custom param in "bitrix:main.include" datepicker. Битрикс, параметр у компонента "bitrix:main.include" в виде календаря с возможностью выбора даты
<?
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true) die();
$arTemplateParameters = array(
'COUNTDOWN_DATE' => array(
'NAME' => "Дата окончания",
'TYPE' => 'CUSTOM',
// свой подключаемый скрипт
'JS_FILE' => $templateFolder.'/settings.js',
// функция из подключенного скрипта JS_FILE, вызывается при отрисовке окна настроек
'JS_EVENT' => 'OnMySettingsEdit',
// доп. данные, передаются в функцию из JS_EVENT
'JS_DATA' => json_encode(array('set' => '')),
'DEFAULT' => null,
'PARENT' => 'BASE',
),
);
?>
function OnMySettingsEdit(arParams) {
arParams.oInput.type = "text";
arParams.oInput.onclick = BX.delegate(function() {
BX.calendar({
node: arParams.oInput,
//value: arParams.oInput.value,
field: arParams.oInput,
callback_after: function(){
arParams.oInput.value = arParams.oInput.value;
}
});
return false;
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment