/** * * add gallery from data by gallery name */ public function addGaleryFromData($type, $data) { $objGallery = new UniteGalleryGallery(); $params = UniteFunctionsUG::getVal($data, "params", array()); if (is_array($params) == false) { $params = array(); } $mainParams = UniteFunctionsUG::getVal($data, "main"); if (!empty($mainParams)) { $params = array_merge($mainParams, $params); } //create items category if needed $category = UniteFunctionsUG::getVal($params, "category"); if ($category == "new") { $objGallery->validateInputSettings($params, false); $title = $params["title"]; $objCategories = new UniteGalleryCategories(); $response = $objCategories->add($title); $newCategoryID = $response["id"]; $params["category"] = $newCategoryID; $params["categories"] = $newCategoryID; } $galleryID = $objGallery->create($type, $params); return $galleryID; }