69 $this->request = Main\Context::getCurrent()->getRequest();
80 $this->request =
null;
143 $list += static::getSliderOptions();
145 $this->urlParams = array_filter($list, [__CLASS__,
'clearNull']);
185 abstract public function use(): bool;
187 public function getSectionListUrl(?
int $parentId, array $options = [],
string $additional =
''): string
191 $this->
getListVariables(self::PAGE_SECTION_LIST, $parentId, $options, $additional)
199 $this->
getDetailVariables(self::PAGE_SECTION_DETAIL, $entityId, $options, $additional)
203 public function getSectionSaveUrl(?
int $entityId, array $options = [],
string $additional =
''): string
219 public function getElementListUrl(?
int $parentId, array $options = [],
string $additional =
''): string
223 $this->
getListVariables(self::PAGE_ELEMENT_LIST, $parentId, $options, $additional)
231 $this->
getDetailVariables(self::PAGE_ELEMENT_DETAIL, $entityId, $options, $additional)
235 public function getElementCopyUrl(?
int $entityId, array $options = [],
string $additional =
''): string
243 public function getElementSaveUrl(?
int $entityId, array $options = [],
string $additional =
''): string
267 public function getElementSeoUrl(
int $productId, array $options = [],
string $additional =
''): string
275 public function getSectionSeoUrl(
int $sectionId, array $options = [],
string $additional =
''): string
290 if ($this->iblockId ===
null)
295 return 'IBLOCK_ID='.$this->iblockId
296 .
'&type='.urlencode($this->iblock[
'IBLOCK_TYPE_ID'])
297 .
'&lang='.urlencode($this->languageId);
300 public function getUrlParams(array $options = [],
string $additional =
''): string
302 return $this->
getBaseParams().$this->extendUrl($options, $additional);
307 return 'lang='.urlencode($this->languageId);
312 return 'urlBuilderId='.urlencode($this->
id);
317 $this->sliderMode = $mode;
332 $path = \CUtil::JSEscape($path);
335 .
'window.history.replaceState({}, \'\', \'' . $path .
'\');
' . "\n"
336 . 'BX.ready(
function () {
' . "\n"
337 . ' BX.SidePanel.Instance.open(
' . "\n"
338 . ' \
'' . $path .
'\'' .
"\n"
352 $currentPage = $this->request->getRequestedPage();
353 foreach ($urlList as $url)
355 if (strncmp($currentPage, $url, strlen($url)) === 0)
366 $this->
id = static::TYPE_ID;
367 $this->weight = static::TYPE_WEIGHT;
380 return $value !==
null;
385 $this->iblockId =
null;
386 $this->iblock =
null;
387 $this->iblockListMode =
null;
392 if ($this->iblockListMode !==
null)
397 if ($this->iblockId !==
null)
399 $listMode = (string)$this->iblock[
'LIST_MODE'];
406 $listMode = (Main\Config\Option::get(
'iblock',
'combined_list_mode') ===
'Y'
407 ? Iblock\IblockTable::LIST_MODE_COMBINED
408 : Iblock\IblockTable::LIST_MODE_SEPARATE
411 $this->iblockListMode = $listMode;
412 $this->iblockListMixed = ($this->iblockListMode === Iblock\IblockTable::LIST_MODE_COMBINED);
422 $this->iblockListMode = $listMode;
423 $this->iblockListMixed = ($this->iblockListMode === Iblock\IblockTable::LIST_MODE_COMBINED);
437 $params = array_filter($params, [__CLASS__,
'clearNull']);
442 foreach ($params as $key => $value)
444 if (
$prefix ===
'' && is_numeric($key))
449 if (is_array($value))
455 $result .=
'&'.urlencode($index).
'='.urlencode((
string)$value);
458 unset($index, $key, $value);
464 if ($parentId !==
null)
466 if ($parentId === -1)
469 'find_section_section' => $parentId
472 elseif ($parentId >= 0)
475 'find_section_section' => $parentId,
476 'SECTION_ID' => $parentId,
477 'apply_filter' =>
'Y'
488 if ($entityId !==
null && $entityId >= 0)
498 protected function extendUrl(array $options = [],
string $additional =
''): string
502 if ($compiledOptions !==
'')
504 $result .= $compiledOptions;
506 unset($compiledOptions);
508 if ($additional !==
'')
510 $result .= $additional;
519 return ($this->urlTemplates[$templateId] ??
null);
524 if ($template ===
null)
528 if (empty($replaces))
532 return str_replace(array_keys($replaces), array_values($replaces), $template);
537 $this->templateVariables[$name] = $value;
548 $replaces[
'#ADDITIONAL_PARAMETERS#'] = $this->
extendUrl($options, $additional);
552 protected function getListVariables(
string $page, ?
int $parentId, array $options = [],
string $additional =
''): array
555 $replaces[
'#PARENT_ID#'] = (string)$parentId;
560 protected function getDetailVariables(
string $page, ?
int $entityId, array $options = [],
string $additional =
''): array
563 $replaces[
'#ENTITY_ID#'] = (string)$entityId;
571 $replaces[
'#PRODUCT_ID#'] = (string)$entityId;
579 $replaces[
'#SECTION_ID#'] = (string)$sectionId;
586 return '&action=copy';
597 'IFRAME_TYPE' =>
'SIDE_SLIDER',
603 return $this->request->get(self::SLIDER_PATH_VARIABLE);
614 self::SLIDER_PATH_VARIABLE => $path,
625 return self::SLIDER_PATH_VARIABLE .
'=' . $path;
634 if ($path ===
null || $path ===
'')
642 if (preg_match($mask, $path, $prepared))
setIblockId(int $iblockId)
getUrlParams(array $options=[], string $additional='')
const PAGE_ELEMENT_DETAIL
getSectionListUrl(?int $parentId, array $options=[], string $additional='')
fillUrlTemplate(?string $template, array $replaces)
preloadElementUrlData(array $elementIds)
const PAGE_SECTION_DETAIL
checkCurrentPage(array $urlList)
setUrlParams(array $list)
setSliderMode(bool $mode)
getSectionSeoVariables(?int $sectionId, array $options=[], string $additional='')
getSectionSeoUrl(int $sectionId, array $options=[], string $additional='')
compileParamsLevel(string &$result, string $prefix, array $params)
getContextMenuItems(string $pageType, array $items=[], array $options=[])
getElementSearchUrl(array $options=[], string $additional='')
const PAGE_SECTION_SEARCH
getDetailVariables(string $page, ?int $entityId, array $options=[], string $additional='')
getCatalogSeoUrl(array $options=[], string $additional='')
preloadSectionUrlData(array $sectionIds)
setIblockListMode(string $listMode)
subscribeOnAfterSettingsSave()
getElementListUrl(?int $parentId, array $options=[], string $additional='')
setLanguageId(string $languageId)
getDetailSeoVariables(?int $entityId, array $options=[], string $additional='')
getSliderPathOption(string $path)
getElementDetailUrl(?int $entityId, array $options=[], string $additional='')
getSectionDetailUrl(?int $entityId, array $options=[], string $additional='')
checkSliderPath(?string $path)
getSliderPathString(string $path)
setPrefix(string $prefix)
getElementSaveUrl(?int $entityId, array $options=[], string $additional='')
const PAGE_ELEMENT_SEARCH
getElementCopyUrl(?int $entityId, array $options=[], string $additional='')
preloadUrlData(string $entityType, array $entityIds)
static getSliderOptions()
getSectionSearchUrl(array $options=[], string $additional='')
getCompiledParams(array $params)
getEntityFilter(?int $entityId)
getListVariables(string $page, ?int $parentId, array $options=[], string $additional='')
getParentFilter(?int $parentId)
compileUrlParams(array $params)
const SLIDER_PATH_VARIABLE
getUrlTemplate(string $templateId)
getElementSeoUrl(int $productId, array $options=[], string $additional='')
getExtendedVariables(array $options=[], string $additional='')
setTemplateVariable(string $name, string $value)
getSectionSaveUrl(?int $entityId, array $options=[], string $additional='')
extendUrl(array $options=[], string $additional='')