You are here

public function Content::postContent in GatherContent 8

Same name and namespace in other branches
  1. 8.3 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 165
Contains GatherContent\Accont class.

Class

Content
Class Account.

Namespace

Drupal\gathercontent\DAO

Code

public function postContent($content_id, array $config) {
  try {
    $response = $this->client
      ->post('/items/' . $content_id . '/save', array(
      'body' => array(
        'config' => base64_encode(json_encode($config)),
      ),
    ));
    if ($response
      ->getStatusCode() === 202) {
      return TRUE;
    }
    else {
      return FALSE;
    }
  } catch (\Exception $e) {
    return FALSE;
  }
}