public function Content::postContent in GatherContent 8.3
Same name and namespace in other branches
- 8 src/DAO/Content.php \Drupal\gathercontent\DAO\Content::postContent()
Update content in GatherContent.
Parameters
int $content_id: ID of content we want to update.
array $config: Configration array.
Return value
bool Return boolean value.
File
- src/
DAO/ Content.php, line 160
Class
- Content
- Class Account.
Namespace
Drupal\gathercontent\DAOCode
public function postContent($content_id, array $config) {
try {
$response = $this->client
->post('/items/' . $content_id . '/save', [
'form_params' => [
'config' => base64_encode(json_encode($config)),
],
]);
if ($response
->getStatusCode() === 202) {
return TRUE;
}
else {
\Drupal::logger('gathercontent')
->alert('Upload return code:' . $response
->getStatusCode(), TRUE);
return FALSE;
}
} catch (\Exception $e) {
\Drupal::logger('gathercontent')
->alert(print_r($e
->getMessage(), TRUE));
return FALSE;
}
}