HFP-3048 Add support for updating existing content
parent
8b317fa5fe
commit
e65b22f0d1
|
@ -3743,16 +3743,23 @@ class H5PCore {
|
||||||
*
|
*
|
||||||
* @param array $data Data from content publishing process
|
* @param array $data Data from content publishing process
|
||||||
* @param array $files Files to upload with the content publish
|
* @param array $files Files to upload with the content publish
|
||||||
|
* @param bigint $content_hub_id For updating existing content
|
||||||
* @return stdClass
|
* @return stdClass
|
||||||
*/
|
*/
|
||||||
public function hubPublishContent($data, $files) {
|
public function hubPublishContent($data, $files, $content_hub_id = NULL) {
|
||||||
$headers = array(
|
$headers = array(
|
||||||
'Authorization' => $this->hubGetAuthorizationHeader(),
|
'Authorization' => $this->hubGetAuthorizationHeader(),
|
||||||
'Accept' => 'application/json',
|
'Accept' => 'application/json',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$endpoint = H5PHubEndpoints::CONTENT;
|
||||||
|
if ($content_hub_id !== NULL) {
|
||||||
|
$endpoint .= "/{$content_hub_id}";
|
||||||
|
$data['_method'] = 'PUT';
|
||||||
|
}
|
||||||
|
|
||||||
$response = $this->h5pF->fetchExternalData(
|
$response = $this->h5pF->fetchExternalData(
|
||||||
H5PHubEndpoints::createURL(H5PHubEndpoints::CONTENT),
|
H5PHubEndpoints::createURL($endpoint),
|
||||||
$data, TRUE, NULL, TRUE, $headers, $files
|
$data, TRUE, NULL, TRUE, $headers, $files
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue