PHP code example of bywatersolutions / silverstripe-jsoneditorfield
1. Go to this page and download the library: Download bywatersolutions/silverstripe-jsoneditorfield library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
bywatersolutions / silverstripe-jsoneditorfield example snippets
use ByWaterSolutions\JsonEditorField\JsonEditorField;
...
private static $db = array[
'MyJson' => 'Text'
];
public function getCMSFields() {
$fields = parent::getCMSFields();
$schema = file_get_contents("path/to/your/schema.json");
$fields->addFieldToTab("Root.Main", new JsonEditorField("MyJson", "My JSON Document", $this->MyJson, null, $schema));
return $fields;
}