Admin_SettingsController::videoThumbnailUpdateAction PHP Метод

videoThumbnailUpdateAction() публичный Метод

    public function videoThumbnailUpdateAction()
    {
        $this->checkPermission("thumbnails");
        $pipe = Asset\Video\Thumbnail\Config::getByName($this->getParam("name"));
        $data = \Zend_Json::decode($this->getParam("configuration"));
        $items = [];
        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(["success" => true]);
    }