/** * Add an application to the desktop * @param Application|array $application * @param bool $createDesktopShortcut If you want to automatically create a shortcut on the desktop * @return bool * @throws InvalidConfigException */ public function registerApplication($application, $createDesktopShortcut = true) { if (!$application instanceof Application) { if (!is_array($application)) { throw new InvalidConfigException('Invalid application specified'); } if (!isset($application['class'])) { $application['class'] = Application::className(); } $application = \Yii::createObject($application); } if (array_key_exists($application->id, $this->applications)) { throw new InvalidConfigException("application {$application->id} is already defined"); } $application->setDesktop($this); $this->applications[$application->id] = $application; if ($createDesktopShortcut) { $this->registerShortcut(Shortcut::fromApplication($application)); } return true; }