/** * Prepares component parameters. * @return $this * @throws ArgumentException */ protected function prepareParams() { parent::prepareParams(); if (!empty($this->arParams['STORAGE'])) { if (!$this->arParams['STORAGE'] instanceof Storage) { throw new ArgumentException('STORAGE must be instance of \\Bitrix\\Disk\\Storage'); } } elseif (!empty($this->arParams['STORAGE_ID'])) { $this->arParams['STORAGE_ID'] = (int) $this->arParams['STORAGE_ID']; } else { if (empty($this->arParams['STORAGE_MODULE_ID'])) { throw new ArgumentException('STORAGE_MODULE_ID required'); } if (empty($this->arParams['STORAGE_ENTITY_TYPE'])) { throw new ArgumentException('STORAGE_ENTITY_TYPE required'); } if (!isset($this->arParams['STORAGE_ENTITY_ID'])) { throw new ArgumentException('STORAGE_ENTITY_ID required'); } } if (empty($this->arParams['PATH_TO_USER'])) { $siteId = SITE_ID; $currentUser = User::buildFromArray($this->getUser()->getById($this->getUser()->getId())->fetch()); $default = '/company/personal/user/#user_id#/'; if ($currentUser->isExtranetUser()) { /** @noinspection PhpDynamicAsStaticMethodCallInspection */ $siteId = \CExtranet::getExtranetSiteID(); $default = '/extranet/contacts/personal/user/#user_id#/'; } $this->arParams['PATH_TO_USER'] = strtolower(COption::getOptionString('intranet', 'path_user', $default, $siteId)); } return $this; }
protected function prepareParams() { parent::prepareParams(); if (isset($this->arParams['BREADCRUMBS_ID']) && $this->arParams['BREADCRUMBS_ID'] !== '') { $this->arParams['BREADCRUMBS_ID'] = preg_replace('/[^a-z0-9_]/i', '', $this->arParams['BREADCRUMBS_ID']); } else { $this->arParams['BREADCRUMBS_ID'] = 'breadcrumbs_' . strtolower(randString(5)); } if (!isset($this->arParams['SHOW_ONLY_DELETED'])) { $this->arParams['SHOW_ONLY_DELETED'] = false; } if (!isset($this->arParams['BREADCRUMBS'])) { $this->arParams['BREADCRUMBS'] = array(); } return $this; }
protected function prepareParams() { parent::prepareParams(); if (empty($this->arParams['BUTTONS']) || !is_array($this->arParams['BUTTONS'])) { $this->arParams['BUTTONS'] = array(); } if (isset($this->arParams['TOOLBAR_ID']) && $this->arParams['TOOLBAR_ID'] !== '') { $this->arParams['TOOLBAR_ID'] = preg_replace('/[^a-z0-9_]/i', '', $this->arParams['TOOLBAR_ID']); } else { $this->arParams['TOOLBAR_ID'] = 'toolbar_' . strtolower(randString(5)); } if (empty($this->arParams['DROPDOWN_FILTER']) || !is_array($this->arParams['DROPDOWN_FILTER'])) { $this->arParams['DROPDOWN_FILTER'] = null; $this->arParams['DROPDOWN_FILTER_CURRENT_LABEL'] = null; } if (empty($this->arParams['CLASS_NAME'])) { $this->arParams['CLASS_NAME'] = ''; } return $this; }