diff --git a/lib/Drupal/views/View.php b/lib/Drupal/views/View.php index aad6ace885e21ea9656c595bddc6fae320d2dc6c..4c7a71cf533fef74396e30c6d5c8630a2d714161 100644 --- a/lib/Drupal/views/View.php +++ b/lib/Drupal/views/View.php @@ -21,9 +21,7 @@ * An object to contain all of the data to generate a view, plus the member * functions to build the view query, execute the query and render the output. */ -class View extends ViewsDbObject { - - var $db_table = 'views_view'; +class View extends ViewStorage { var $base_table = 'node'; @@ -36,13 +34,6 @@ class View extends ViewsDbObject { */ var $name = ""; - /** - * The id of the view, which is used only for views in the database. - * - * @var number - */ - var $vid; - /** * The description of the view, which is used only in the interface. * @@ -275,17 +266,6 @@ class View extends ViewsDbObject { */ protected $response = NULL; - /** - * Constructor - */ - function __construct() { - parent::init(); - // Make sure all of our sub objects are arrays. - foreach ($this->db_objects() as $key => $object) { - $this->$key = array(); - } - } - /** * Perform automatic updates when loading or importing a view. * @@ -308,14 +288,6 @@ function display_objects() { return array('argument', 'field', 'sort', 'filter', 'relationship', 'header', 'footer', 'empty'); } - /** - * Returns the complete list of dependent objects in a view, for the purpose - * of initialization and loading/saving to/from the database. - */ - static function db_objects() { - return array('display' => 'Display'); - } - /** * Set the arguments that come to this view. Usually from the URL * but possibly from elsewhere. diff --git a/lib/Drupal/views/ViewsDisplay.php b/lib/Drupal/views/ViewsDisplay.php index af7f47ac62d07e962792b0b66360a314f6dbeb86..5bcda2faece134f9a464ac1f449ccd14a683c466 100644 --- a/lib/Drupal/views/ViewsDisplay.php +++ b/lib/Drupal/views/ViewsDisplay.php @@ -13,32 +13,30 @@ * This is just the database storage mechanism, and isn't terribly important * to the behavior of the display at all. */ -class ViewsDisplay extends ViewsDbObject { +class ViewsDisplay { /** * The display handler itself, which has all the methods. * * @var views_plugin_display */ - var $handler; + public $handler; /** * Stores all options of the display, like fields, filters etc. * * @var array */ - var $display_options; + public $display_options; - var $db_table = 'views_display'; + function __construct(array $display_options = array()) { + $this->display_options = $display_options; - function __construct($init = TRUE) { - parent::init($init); - } - - function options($type, $id, $title) { - $this->display_plugin = $type; - $this->id = $id; - $this->display_title = $title; + if (!empty($display_options)) { + $this->display_plugin = $display_options['display_plugin']; + $this->id = $display_options['id']; + $this->display_title = $display_options['display_title']; + } } } diff --git a/views.info b/views.info index adea473de7f1cee102bfc1a50ed73110664a8989..77703ce043815a8918101dbddad271330cd171b5 100644 --- a/views.info +++ b/views.info @@ -4,6 +4,7 @@ package = Views core = 8.x php = 5.2 dependencies[] = ctools +dependencies[] = config ; Always available CSS stylesheets[all][] = css/views.base.css diff --git a/views.module b/views.module index f6d811640b953e04e75cb642410ba99ae3ce4b7a..930b100309bd1a3834d1fc3f1e95ac2f3ac32e10 100644 --- a/views.module +++ b/views.module @@ -75,25 +75,28 @@ function views_temp_store() { } /** - * Implements hook_ctools_exportable_info(). + * Implements hook_entity_info(). */ -function views_ctools_exportable_info() { - return array( +function views_entity_info() { + $return = array( 'view' => array( - 'controller class' => 'Drupal\ctools\DatabaseExportableController', - 'key' => 'name', - 'identifier' => 'view', - 'default hook' => 'views_default_views', - 'bulk export' => TRUE, - 'api' => array( - 'owner' => 'views', - 'api' => 'views_default', - 'minimum_version' => '2', - 'current_version' => '3.0', + 'label' => t('View'), + 'entity class' => 'Drupal\views\View', + 'controller class' => 'Drupal\views\ViewStorageController', + 'form controller class' => array( + 'default' => 'Drupal\node\NodeFormController', + ), + 'config prefix' => 'views.view', + 'fieldable' => FALSE, + 'entity keys' => array( + 'id' => 'name', + 'label' => 'human_name', + 'uuid' => 'uuid', ), - 'schema' => 'views_view', ), ); + + return $return; } /**