1. Go to this page and download the library: Download itgro/extensions library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
/**
* В этом примере будут доступны запросы вида `/ajax/feedback/%method%/`,
* каждый из которых будет делигироваться в соответствующий класс на соответствующий метод
*/
event_manager()->addEventHandler('extensions', \Itgro\Ajax\Distributor::EXPAND_HANDLERS_EVENT, function (\Bitrix\Main\Event $event) {
return new \Bitrix\Main\EventResult(\Bitrix\Main\EventResult::SUCCESS, [
'feedback' => \Namespace\Some\Class::class,
]);
})
(new \Namespace\IBlockExtended\Entity)->addElementPropertyInformation(
'IBLOCK_PROPERTY_CODE', // Код свойства, для которого отрабатывается js-функция
function ($propertyId) {
// JavaScript-код или JavaScript-функция, которые будут обрабатываться только на странице, где есть свойство с указанным кодом
return 'javascriptFunctionName';
}
)
(new \Namespace\IBlockExtended\Entity)->addElementAdminButton(
(new \Itgro\Bitrix\Admin\Button\ElementEdit)
->withProperties([
'iblock_type' => 'iblock_type_id', // Тип ИБ связанной страницы
'iblock_code' => 'iblock_code', // Код ИБ связанной страницы
'filter' => [
// Фильтр по текущей сущности
['type' => 'property', 'code' => 'RELATED_PROPERTY_CODE'],
],
])
->withView([
'place' => 'before', // Добавлять до или после кнопки копирования
'style' => 'adm-btn-green', // Доп.классы для кнопки
'name' => 'Элементы', // Заголовок кнопки
])
);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.