getByName() public static method

public static getByName ( $name ) : null | Config
$name
return null | Config
コード例 #1
0
ファイル: Dao.php プロジェクト: jansarmir/pimcore
 /**
  * Loads a list of predefined properties for the specicifies parameters, returns an array of Property\Predefined elements
  *
  * @return array
  */
 public function load()
 {
     $properties = array();
     $propertiesData = $this->db->fetchAll($this->model->getFilter(), $this->model->getOrder());
     foreach ($propertiesData as $propertyData) {
         $properties[] = Config::getByName($propertyData["id"]);
     }
     $this->model->setThumbnails($properties);
     return $properties;
 }
コード例 #2
0
ファイル: Video.php プロジェクト: emanuel-london/pimcore
 /**
  * @param string $config
  * @return Video\Thumbnail\Config|null
  */
 public function getThumbnailConfig($config)
 {
     $thumbnail = null;
     if (is_string($config)) {
         $thumbnail = Video\Thumbnail\Config::getByName($config);
     } elseif ($config instanceof Video\Thumbnail\Config) {
         $thumbnail = $config;
     }
     return $thumbnail;
 }
コード例 #3
0
ファイル: Video.php プロジェクト: ChristophWurst/pimcore
 /**
  * @param string $config
  * @return Video\Thumbnail\Config|null
  */
 public function getThumbnailConfig($config)
 {
     $thumbnail = null;
     if (is_string($config)) {
         try {
             $thumbnail = Video\Thumbnail\Config::getByName($config);
         } catch (\Exception $e) {
             \Logger::error("requested video-thumbnail " . $config . " is not defined");
             return null;
         }
     } else {
         if ($config instanceof Video\Thumbnail\Config) {
             $thumbnail = $config;
         }
     }
     return $thumbnail;
 }
コード例 #4
0
 public function videoThumbnailUpdateAction()
 {
     $this->checkPermission("thumbnails");
     $pipe = Asset\Video\Thumbnail\Config::getByName($this->getParam("name"));
     $data = \Zend_Json::decode($this->getParam("configuration"));
     $items = array();
     foreach ($data as $key => $value) {
         $setter = "set" . ucfirst($key);
         if (method_exists($pipe, $setter)) {
             $pipe->{$setter}($value);
         }
         if (strpos($key, "item.") === 0) {
             $cleanKeyParts = explode(".", $key);
             $items[$cleanKeyParts[1]][$cleanKeyParts[2]] = $value;
         }
     }
     $pipe->resetItems();
     foreach ($items as $item) {
         $type = $item["type"];
         unset($item["type"]);
         $pipe->addItem($type, $item);
     }
     $pipe->save();
     $this->deleteVideoThumbnailTmpFiles($pipe);
     $this->_helper->json(array("success" => true));
 }
コード例 #5
0
            $name = str_replace(".xml", "", $file);
            $thumbnail = Asset\Image\Thumbnail\Config::getByName($name);
            $thumbnail = object2array($thumbnail);
            $thumbnail["id"] = $thumbnail["name"];
            unset($thumbnail["name"]);
            $json->insertOrUpdate($thumbnail, $thumbnail["id"]);
        }
    }
    // move data
    rename($dir, $legacyFolder . "/imagepipelines");
}
// VIDEO THUMBNAILS
$dir = PIMCORE_CONFIGURATION_DIRECTORY . "/videopipelines";
if (is_dir($dir)) {
    $file = Pimcore\Config::locateConfigFile("video-thumbnails");
    $json = \Pimcore\Db\JsonFileTable::get($file);
    $json->truncate();
    $files = scandir($dir);
    foreach ($files as $file) {
        if (strpos($file, ".xml")) {
            $name = str_replace(".xml", "", $file);
            $thumbnail = Asset\Video\Thumbnail\Config::getByName($name);
            $thumbnail = object2array($thumbnail);
            $thumbnail["id"] = $thumbnail["name"];
            unset($thumbnail["name"]);
            $json->insertOrUpdate($thumbnail, $thumbnail["id"]);
        }
    }
    // move data
    rename($dir, $legacyFolder . "/videopipelines");
}