Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // telegram post: https://t.me/bitrixoid_iz_kolhoza/345
- // Class example
- namespace AlexeyGfi;
- use CBitrixComponent;
- use CComponentPanel;
- class ComponentParametersHinter
- {
- public static function placeSmartHint($componentLabels = null): void
- {
- global $APPLICATION;
- $bDrawIcons = $APPLICATION->GetShowIncludeAreas();
- if (!$bDrawIcons) {
- return;
- }
- $componentName = $componentLabels['componentName'] ?? null;
- $menuTitle = $componentLabels['menuTitle'] ?? null;
- if (!$menuTitle || !$componentName) {
- return;
- }
- $componentTemplate = $componentLabels['componentTemplate'] ?? '.default';
- $parentComponent = $componentLabels['parentComponent'] ?? null;
- echo $APPLICATION->IncludeStringBefore();
- $component = new CBitrixComponent();
- if ($component->InitComponent($componentName)) {
- $panel = new CComponentPanel(
- $component,
- $componentName,
- $componentTemplate,
- $parentComponent,
- true
- );
- $arIcons = $panel->GetIcons();
- $arIcons['parameters']['COMPONENT_DESCRIPTION']['NAME'] = $menuTitle;
- $arIcons['parameters']['TOOLTIP']['TITLE'] = $menuTitle;
- echo $s = $APPLICATION->IncludeStringAfter(
- $arIcons['icons'],
- $arIcons['parameters']
- );
- }
- }
- }
- // Usage example
- // ...don't forget set ['HIDE_ICONS' => 'Y']
- use AlexeyGfi\ComponentParametersHinter;
- ComponentParametersHinter::placeSmartHint([
- 'componentName' => 'bitrix:catalog.section.list',
- 'componentTemplate' => 'fotogallery.katalog.sections',
- 'parentComponent' => $this,
- 'menuTitle' => 'Товары на фото'
- ]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement