parent
eb52ec25a0
commit
8b317fa5fe
|
@ -3712,6 +3712,32 @@ class H5PCore {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Publish content on the H5P Hub.
|
||||||
|
*
|
||||||
|
* @param bigint $id
|
||||||
|
* @return stdClass
|
||||||
|
*/
|
||||||
|
public function hubRetrieveContent($id) {
|
||||||
|
$headers = array(
|
||||||
|
'Authorization' => $this->hubGetAuthorizationHeader(),
|
||||||
|
'Accept' => 'application/json',
|
||||||
|
);
|
||||||
|
|
||||||
|
$response = $this->h5pF->fetchExternalData(
|
||||||
|
H5PHubEndpoints::createURL(H5PHubEndpoints::CONTENT . "/{$id}"),
|
||||||
|
NULL, TRUE, NULL, TRUE, $headers
|
||||||
|
);
|
||||||
|
|
||||||
|
if (empty($response['data'])) {
|
||||||
|
throw new Exception($this->h5pF->t('Unable to authorize with the H5P Hub. Please check your Hub registration and connection.'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$hub_content = json_decode($response['data'])->data;
|
||||||
|
$hub_content->id = "$hub_content->id";
|
||||||
|
return $hub_content;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Publish content on the H5P Hub.
|
* Publish content on the H5P Hub.
|
||||||
*
|
*
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue