示例#1
0
 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
 /**
  * @return array
  */
 public function getViews()
 {
     return array('setup' => 'Edit element') + parent::getViews();
 }