function views_db_object::init

cis7 view.inc views_db_object::init($init = TRUE)
cle7 view.inc views_db_object::init($init = TRUE)
elmsmedia7 view.inc views_db_object::init($init = TRUE)
icor7 view.inc views_db_object::init($init = TRUE)
meedjum_blog7 view.inc views_db_object::init($init = TRUE)
mooc7 view.inc views_db_object::init($init = TRUE)

Initialize this object, setting values from schema defaults.

Parameters

$init: If an array, this is a set of values from db_fetch_object to load. Otherwse, if TRUE values will be filled in from schema defaults.

File

sites/all/modules/ulmus/views/includes/view.inc, line 2159
Provides the view object type and associated methods.

Class

views_db_object
Base class for views' database objects.

Code

function init($init = TRUE) {
  if (is_array($init)) {
    return $this->load_row($init);
  }

  if (!$init) {
    return;
  }

  $schema = drupal_get_schema($this->db_table);

  if (!$schema) {
    return;
  }

  // Go through our schema and build correlations.
  foreach ($schema['fields'] as $field => $info) {
    if ($info['type'] == 'serial') {
      $this->$field = NULL;
    }
    if (!isset($this->$field)) {
      if (!empty($info['serialize']) && isset($info['serialized default'])) {
        $this->$field = unserialize($info['serialized default']);
      }
      elseif (isset($info['default'])) {
        $this->$field = $info['default'];
      }
      else {
        $this->$field = '';
      }
    }
  }
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.