@@ -57,9 +57,10 @@ public function __construct(
5757 $ environment = '' ,
5858 $ config = array ('region ' => '' , 'branch ' => '' , 'live_preview ' => array ())
5959 ) {
60-
60+ $ previewHost = ' api.contentstack.io ' ;
6161 if ($ config && $ config !== "undefined " && array_key_exists ('region ' , $ config ) && $ config ['region ' ] !== "undefined " && $ config ['region ' ] =="eu " ) {
6262 $ this ->host = $ config ['region ' ].'-cdn.contentstack.com ' ;
63+ $ previewHost = $ config ['region ' ].'-api.contentstack.com ' ;
6364 }
6465 $ this ->header = Utility::validateInput (
6566 'stack ' , array ('api_key ' => $ api_key ,
@@ -70,7 +71,8 @@ public function __construct(
7071 );
7172 $ this ->environment = $ this ->header ['environment ' ];
7273 unset($ this ->header ['environment ' ]);
73- $ this ->live_preview = $ config ['live_preview ' ] ?? array ();
74+ $ livePreview = array ('enable ' => false , 'host ' => $ previewHost );
75+ $ this ->live_preview = $ config ['live_preview ' ] ? array_merge ($ livePreview , $ config ['live_preview ' ]) : $ livePreview ;
7476 return $ this ;
7577 }
7678
@@ -139,7 +141,7 @@ public function ImageTrasform($url, $parameters)
139141
140142 public function LivePreviewQuery ($ parameters ) {
141143 $ this ->live_preview ['live_preview ' ] = $ parameters ['live_preview ' ] ?? 'init ' ;
142- $ this ->live_preview ['content_type_uid ' ] = $ parameters ['content_type_uid ' ];
144+ $ this ->live_preview ['content_type_uid ' ] = $ parameters ['content_type_uid ' ] ?? null ;
143145 }
144146
145147 /**
0 commit comments