R
R
Roman Kuzmenko2020-10-29 12:01:09
1C-Bitrix
Roman Kuzmenko, 2020-10-29 12:01:09

How to add a Bitrix24 menu item?

Hello! Tell me how you can add a menu item in the CRM section?

5f9a84d3d1cbb842011711.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Nikolaev, 2020-10-29
@devrvk

For this particular menu item, there is a wonderful event OnAfterCrmControlPanelBuild
Call example:

\Bitrix\Main\EventManager::getInstance()->addEventHandlerCompatible(
  "crm",
  "OnAfterCrmControlPanelBuild",
  function( &$menuItems ){

    // $menuItems - список элементов меню по ссылке. Можно даже удалить
    $menuItems[] = [
      /**
       * ID пункт меню. Нужен для подсветки на странице
       * @var string
       */
      'ID'      => 'CUSTOM_REPORTS',

      /**
       * ID js-пункта меню. Для счетчиков и action-комманд
       * @var string
       */
      'MENU_ID' => 'menu_crm_custom_reports',

      /**
       * Название и hover title
       * @var string
       */
      'NAME'    => 'Пользовательские отчеты',
      'TITLE'   => 'Пользовательские отчеты',

      /**
       * Ссылка, куда вести по нажатию
       * @var string
       */
      'URL'     => '/crm/_some_link_/',
    ];	
  }
);

Well, actually on your page you need to call an additional component:
$APPLICATION->IncludeComponent(
  'bitrix:crm.control_panel',
  '',
  array(
    'ID'             => 'CUSTOM_REPORTS',
    'ACTIVE_ITEM_ID' => 'CUSTOM_REPORTS',
  )
);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question