PagesExportImport::importJSON() method

Import a PageArray from a JSON string

Given JSON string must be one previously exported by the exportJSON() method in this class.

Usage

// basic usage
$items = $porter->importJSON(string $json);

// usage with all arguments
$items = $porter->importJSON(string $json, array $options = []);

Arguments

NameType(s)Description
$jsonstring

JSON string of exported data to import

$options (optional)array
  • commit (bool): Commit/save the changes now? Specify false to perform a test import. Default:true
  • update (bool): Allow update of existing pages? Default:true
  • create (bool): Allow creation of new pages? Default:true
  • parent (Page|string|int): Parent Page, path or ID. Omit to use import data Default:0
  • template (Template|string|int): Template object, name or ID. Omit to use import data Default:0
  • fieldNames (array): Import only these field names, or omit to use all import data Default:[]
  • changeStatus (bool): Allow status to be changed aon existing pages? Default:true
  • changeSort (bool): Allow sort and sortfield to be changed on existing pages? Default:true
  • Note: all the "change" prefix options require update=true.

Return value


$porter methods and properties

API reference based on ProcessWire core version 3.0.252