You are here

protected function Box::setFields in Boxes 7.2

Set the fields from the defaults and plugin This can be called externally via loadUP()

1 call to Box::setFields()
Box::loadUp in includes/boxes.core.inc
This is a work around for version of PDO that call __construct() before it loads up the object with values from the DB.

File

includes/boxes.core.inc, line 214
Box classes and plugin interface

Class

Box
The Box entity class

Code

protected function setFields() {

  // NOTE: When setFields is called externally $this->data is already unserialized.
  if (!empty($this->plugin) && !empty($this->type)) {
    $values = is_array($this->data) ? $this->data : unserialize($this->data);
    foreach ($this->plugin
      ->values() as $field => $default) {
      $this->{$field} = isset($values[$field]) ? $values[$field] : $default;
    }
  }
}