I've a json file, and from json file I'm creating some dynamic pages, problem is how i can edit language field or how to add new filed through API
I'm doing like this
<?php
$string = file_get_contents('incl/codes.json');
$json_a = json_decode($string, true);
$arabic = $languages->get("Arabic");
$page->of(false);
foreach($json_a as $code){
$p = new Page(); // create new page object
$p->template = 'city_code'; // set template
$p->parent = wire('pages')->get('/master_data/city_codes'); // set the parent
$p->name = $code["CITY_CODE"]; // give it a name used in the url for the page
$p->title = $code["CITY_CODE"]; // set page title (not neccessary but recommended)
$p->title->setLanguageValue($arabic, $code["CITY_AR"]);
$p->save();
}
?>