1 view.inc view::__construct($view_data = NULL)

Constructor

File

core/modules/views/includes/view.inc, line 281
Provides the view object type and associated methods.

Class

view

Code

function __construct($view_data = NULL) {
  $this->display = array();
  if ($view_data) {
    foreach ($view_data as $key => $value) {
      $this->$key = $value;
    }
    // Set the view "type".
    if (isset($view_data['module'])) {
      $this->module = $view_data['module'];
      if (empty($view_data['storage']) || $view_data['storage'] == VIEWS_STORAGE_DEFAULT) {
        $this->type = t('Default');
        $this->storage = VIEWS_STORAGE_DEFAULT;
      }
      else {
        $this->type = t('Overridden');
        $this->storage = VIEWS_STORAGE_OVERRIDE;
      }
    }
    else {
      $this->type = t('Normal');
      $this->storage = VIEWS_STORAGE_NORMAL;
    }

    // Convert all stored displays into display objects.
    foreach ($this->display as $display_id => $display) {
      $this->display[$display_id] = new views_display($display['display_plugin'], $display_id, $display['display_title'], $display['display_options']);
    }
  }
}