public function populateData(array $data)
    {
        //attempt to make the storage path if it doesn't already exist
        $path = $this->getStoragePath();

        if (!is_dir($path)) {
            mkdir($path);
        }

        //try to fetch the JSON file
        $file = $path.$this->getOption('name').'.json';

        if (file_exists($file)) {
            $json     = file_get_contents($file);
            $saveData = json_decode($json);

            //run through the saveData and update the associated fields that we populated from the edit fields
            foreach ($saveData as $field => $value) {
                if (array_key_exists($field, $data)) {
                    $data[$field] = $value;
                }
            }
        }

        return $data;
    }
public function populateData(array $data)
    {
        //attempt to make the storage path if it doesn't already exist
        $path = $this->getStoragePath();

        if (!is_dir($path)) {
            mkdir($path);
        }

        //try to fetch the JSON file
        $file = $path.$this->getOption('name').'.json';

        if (file_exists($file)) {
            $json     = file_get_contents($file);
            $saveData = json_decode($json);

            //run through the saveData and update the associated fields that we populated from the edit fields
            foreach ($saveData as $field => $value) {
                if (array_key_exists($field, $data)) {
                    $data[$field] = $value;
                }
            }
        }

        return $data;
    }
public function populateData ( array $ data ) { //attempt to make the storage path if it doesn't already exist $ path = $ this -> getStoragePath ( ) ; if ( ! is_dir ( $ path ) ) { mkdir ( $ path ) ; } //try to fetch the JSON file $ file = $ path . $ this -> getOption ( 'name' ) . '.json' ; if ( file_exists ( $ file ) ) { $ json = file_get_contents ( $ file ) ; $ saveData = json_decode ( $ json ) ; //run through the saveData and update the associated fields that we populated from the edit fields foreach ( $ saveData as $ field => $ value ) { if ( array_key_exists ( $ field , $ data ) ) { $ data [ $ field ] = $ value ; } } } return $ data ; }
Populates the data array if it can find the settings file.

@param array $data

@return array
Populates the data array if it can find the settings file .