/**
  * Gibt den Text mit den ersetzten Links zurück
  * @return string
  */
 public function getText()
 {
     $this->text = html_entity_decode($this->text);
     $matches = [];
     // Suchen nach allem, dass in [[ ]] eingeschlossen ist
     preg_match_all('/\\[\\[([\\w\\.\\säöüÄÖÜß]+)\\]\\]/', $this->text, $matches);
     Logging::debug(print_r($matches, true));
     foreach ($matches[1] as $match) {
         $artikel = CmsArtikel::loadByBezeichnung($match, $this->kategorieId);
         if ($artikel == null) {
             Logging::info('Lege Artikel neu an: ' . $match);
             $artikel = new CmsArtikel();
             $artikel->ca_kategorie = $this->kategorieId;
             $artikel->ca_bezeichnung = $match;
             $artikel->ca_aktiv = 1;
             $artikel->ca_autor = Security::getUserId();
             $artikel->save();
             $titel = Text::get($artikel->getElementId() . '.titel');
             $titel->te_text = $match;
             $titel->save();
         }
         $link = EntityLinks::show($artikel);
         $tag = "<a href=\"{$link}\">{$match}</a>";
         $this->text = str_replace('[[' . $match . ']]', $tag, $this->text);
     }
     return $this->text;
 }
 public function endEditArtikel()
 {
     $this->artikel = new CmsArtikel($this->request->id);
     $this->artikel->save($this->request);
     Text::saveArray($this->artikel->getElementId() . '.titel', $this->request->titel);
     Text::saveArray($this->artikel->getElementId() . '.intro', $this->request->intro);
     Text::saveArray($this->artikel->getElementId() . '.text', $this->request->text);
     $this->request->clear();
     $this->request->kategorie = $this->artikel->ca_kategorie;
     FlashMessage::success(Strings::GESPEICHERT);
 }