Skip to content

Commit 6ab6658

Browse files
committed
refactor: ♻️ Management token renamed
1 parent 32bb812 commit 6ab6658

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

src/Stack/Stack.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public function ImageTrasform($url, $parameters)
138138

139139

140140
public function LivePreviewQuery($parameters) {
141-
$this->live_preview['hash'] = $parameters['live_preview'] ?? 'init';
141+
$this->live_preview['live_preview'] = $parameters['live_preview'] ?? 'init';
142142
$this->live_preview['content_type_uid'] = $parameters['content_type_uid'];
143143
}
144144

src/Support/Utility.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,9 @@ public static function contentstackRequest($queryObject = '', $type = '')
379379
$server_output = '';
380380

381381
if ($queryObject) {
382+
if (Utility::isLivePreview($queryObject)) {
383+
$queryObject->_query['live_preview'] = ($queryObject->contentType->stack->live_preview['live_preview'] ?? 'init');
384+
}
382385
$http = curl_init(Utility::contentstackUrl($queryObject, $type));
383386

384387
// setting the HTTP Headers
@@ -388,8 +391,7 @@ public static function contentstackRequest($queryObject = '', $type = '')
388391
$request_headers[] = 'x-user-agent: contentstack-php/1.6.1';
389392
$request_headers[] = 'api_***: '.$Headers["api_***"];
390393
if (Utility::isLivePreview($queryObject)) {
391-
$request_headers[] = 'authorization: '.$queryObject->contentType->stack->live_preview['authorization'] ;
392-
$request_headers[] = 'hash: '.($queryObject->contentType->stack->live_preview['hash'] ?? 'init');
394+
$request_headers[] = 'authorization: '.$queryObject->contentType->stack->live_preview['management_token'] ;
393395
}else {
394396
$request_headers[] = 'access_token: '.$Headers["access_token"];
395397
}

test/EntriesTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public static function setUpBeforeClass() : void {
2828
self::$LivePreviewStack = Contentstack::Stack(self::$rest->getAPIKEY(), self::$rest->getAccessToken(), self::$rest->getEnvironmentName(), array('live_preview' => array(
2929
'enable'=> true,
3030
'host' => 'preview.contentstack.com',
31-
'authorization' => 'token'
31+
'management_token' => 'token'
3232
)));
3333

3434
}

0 commit comments

Comments
 (0)