Merge branch 'content-hub' of github.com:h5p/h5p-php-library into content-hub

content-hub
Thomas Marstrander 2020-09-03 15:02:50 +02:00
commit 645058f03e
No known key found for this signature in database
GPG Key ID: 59D7F1EC8B90E9A6
2 changed files with 14 additions and 7 deletions

View File

@ -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