/** * 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; }