private function addSaveMessage(PlacedWidget $placedWidget, Text $text) { $homeLink = Link::of($text->getUrlMain(), $text->t("main.home")); $documentLink = Link::of($text->getUrlPage("edit_document", $placedWidget->getDocumentId()), $text->t("widgets.view_in_document")); $message = ""; if ($placedWidget->getId() === 0) { // New widget $message = $text->t("main.widget") . " " . $text->t("editor.is_created"); } else { // Updating existing widget $message = $text->t("main.widget") . " " . $text->t("editor.is_edited"); } $text->addMessage($message, $homeLink, $documentLink); }
/** * Gets the URL for this document. * @param Text $text The text object, for URL structure. * @return UriInterface The URL. */ public function getUrl(Text $text) { if ($this->isForWidgetArea()) { return $text->getUrlMain(); } return $text->getUrlPage("document", $this->id); }