コード例 #1
0
ファイル: AbstractImageElement.php プロジェクト: svobodni/web
 protected function applyDefaults(ExtendedElementEntity $entity, $defaults)
 {
     if (isset($defaults['image']) && is_string($defaults['image'])) {
         $file = $this->moduleHelpers->expandPath($defaults['image'], 'Resources/public');
         if (!file_exists($file)) {
             throw new InvalidArgumentException("Path '{$defaults['image']}' does not exist.");
         }
         $entity->image = new FileEntity();
         $entity->image->setFile(new \SplFileInfo($file));
         unset($defaults['image']);
     }
     parent::applyDefaults($entity, $defaults);
 }
コード例 #2
0
ファイル: GalleryElement.php プロジェクト: svobodni/web
 /**
  * @return array
  */
 public function getViews()
 {
     return array('setup' => 'Edit element') + parent::getViews();
 }