/**
  * @param ModelSaveEvent $event
  */
 public function insertUriAlias(ModelSaveEvent $event)
 {
     $formData = $event->getRawData();
     if ($event->getModuleName() !== Schema::MODULE_NAME && !empty($formData['seo_uri_pattern'])) {
         $this->uriAliasManager->insertUriAlias(sprintf($formData['seo_uri_pattern'], $event->getEntryId()), $formData['alias'], $formData['seo_keywords'], $formData['seo_description'], (int) $formData['seo_robots']);
     }
 }
 /**
  * @param ModelSaveEvent $event
  */
 public function generatePictureAliases(ModelSaveEvent $event)
 {
     if ($this->aliases && $this->metaStatements && $this->uriAliasManager) {
         $galleryId = $event->getEntryId();
         $pictures = $this->pictureRepository->getPicturesByGalleryId($galleryId);
         $alias = $this->aliases->getUriAlias(sprintf(Gallery\Helpers::URL_KEY_PATTERN_GALLERY, $galleryId), true);
         $seoKeywords = $this->metaStatements->getKeywords(sprintf(Gallery\Helpers::URL_KEY_PATTERN_GALLERY, $galleryId));
         $seoDescription = $this->metaStatements->getDescription(sprintf(Gallery\Helpers::URL_KEY_PATTERN_GALLERY, $galleryId));
         foreach ($pictures as $picture) {
             $this->uriAliasManager->insertUriAlias(sprintf(Gallery\Helpers::URL_KEY_PATTERN_PICTURE, $picture['id']), !empty($alias) ? $alias . '/img-' . $picture['id'] : '', $seoKeywords, $seoDescription);
         }
     }
 }
Example #3
0
File: Create.php Project: acp3/cms
 /**
  * Setzt einen einzelnen Alias für ein Bild einer Fotogalerie
  *
  * @param integer $pictureId
  *
  * @return boolean
  */
 protected function generatePictureAlias($pictureId)
 {
     if ($this->aliases && $this->metaStatements && $this->uriAliasManager) {
         $galleryId = $this->pictureRepository->getGalleryIdFromPictureId($pictureId);
         $alias = $this->aliases->getUriAlias(sprintf(Gallery\Helpers::URL_KEY_PATTERN_GALLERY, $galleryId), true);
         if (!empty($alias)) {
             $alias .= '/img-' . $pictureId;
         }
         $seoKeywords = $this->metaStatements->getKeywords(sprintf(Gallery\Helpers::URL_KEY_PATTERN_GALLERY, $galleryId));
         $seoDescription = $this->metaStatements->getDescription(sprintf(Gallery\Helpers::URL_KEY_PATTERN_GALLERY, $galleryId));
         return $this->uriAliasManager->insertUriAlias(sprintf(Gallery\Helpers::URL_KEY_PATTERN_PICTURE, $pictureId), $alias, $seoKeywords, $seoDescription);
     }
     return true;
 }