Commit dd8c44b4 authored by webchick's avatar webchick

Issue #1757564 by damiankloip, dawehner, tim.plunkett: Change 'name' to 'id' on View entity.

parent e15c6de8
base_table: node
name: test_bulk_form
id: test_bulk_form
description: ''
tag: ''
human_name: form
......
......@@ -38,7 +38,7 @@ public static function getInfo() {
public function testCommentWizard() {
$view = array();
$view['human_name'] = $this->randomName(16);
$view['name'] = strtolower($this->randomName(16));
$view['id'] = strtolower($this->randomName(16));
$view['show[wizard_key]'] = 'comment';
$view['page[create]'] = TRUE;
$view['page[path]'] = $this->randomName(16);
......@@ -46,7 +46,7 @@ public function testCommentWizard() {
// Just triggering the saving should automatically choose a proper row
// plugin.
$this->drupalPost('admin/structure/views/add', $view, t('Save and edit'));
$this->assertUrl('admin/structure/views/view/' . $view['name'], array(), 'Make sure the view saving was successful and the browser got redirected to the edit page.');
$this->assertUrl('admin/structure/views/view/' . $view['id'], array(), 'Make sure the view saving was successful and the browser got redirected to the edit page.');
// If we update the type first we should get a selection of comment valid
// row plugins as the select field.
......@@ -67,11 +67,11 @@ public function testCommentWizard() {
$expected_options = array('comment', 'fields');
$this->assertEqual($options, $expected_options);
$view['name'] = strtolower($this->randomName(16));
$view['id'] = strtolower($this->randomName(16));
$this->drupalPost(NULL, $view, t('Save and edit'));
$this->assertUrl('admin/structure/views/view/' . $view['name'], array(), 'Make sure the view saving was successful and the browser got redirected to the edit page.');
$this->assertUrl('admin/structure/views/view/' . $view['id'], array(), 'Make sure the view saving was successful and the browser got redirected to the edit page.');
$view = views_get_view($view['name']);
$view = views_get_view($view['id']);
$view->initHandlers();
$row = $view->display_handler->getOption('row');
$this->assertEqual($row['type'], 'comment');
......
......@@ -60,6 +60,6 @@ display:
path: test-comment-rss
human_name: test_comment_rss
module: views
name: test_comment_rss
id: test_comment_rss
tag: ''
uuid: 9b1b1e58-d41b-468a-9d04-4e6bde742c29
......@@ -44,5 +44,5 @@ display:
id: default
position: '0'
human_name: test_comment_user_uid
name: test_comment_user_uid
id: test_comment_user_uid
tag: default
......@@ -34,5 +34,5 @@ display:
id: default
position: '0'
human_name: test_view_fieldapi
name: test_view_fieldapi
id: test_view_fieldapi
tag: default
......@@ -16,5 +16,5 @@ display:
id: default
position: '0'
human_name: ''
name: test_field_type
id: test_field_type
tag: ''
......@@ -46,5 +46,5 @@ display:
id: default
position: '0'
human_name: test_filter_node_uid_revision
name: test_filter_node_uid_revision
id: test_filter_node_uid_revision
tag: default
name: test_node_revision_nid
id: test_node_revision_nid
base_table: node_revision
core: 8
api_version: 3
......
name: test_node_revision_vid
id: test_node_revision_vid
base_table: node_revision
core: 8
api_version: 3
......
base_table: node
name: test_status_extra
id: test_status_extra
description: ''
tag: ''
human_name: test_status_extra
......
base_table: entity_test
name: test_serializer_display_entity
id: test_serializer_display_entity
description: ''
tag: ''
human_name: 'Test serialize display entity rows'
......
base_table: views_test_data
name: test_serializer_display_field
id: test_serializer_display_field
description: ''
tag: ''
human_name: 'Test serializer display field rows'
......
......@@ -62,5 +62,5 @@ display:
human_name: test_groupwise
langcode: und
module: views
name: test_groupwise_term
id: test_groupwise_term
tag: default
......@@ -69,5 +69,5 @@ display:
id: default
position: '0'
human_name: test_taxonomy_node_term_data
name: test_taxonomy_node_term_data
id: test_taxonomy_node_term_data
tag: ''
......@@ -25,5 +25,5 @@ display:
id: default
position: '0'
human_name: ''
name: test_access_perm
id: test_access_perm
tag: ''
......@@ -23,5 +23,5 @@ display:
id: default
position: '0'
human_name: ''
name: test_access_role
id: test_access_role
tag: ''
......@@ -72,5 +72,5 @@ display:
human_name: test_groupwise_user
langcode: und
module: views
name: test_groupwise_user
id: test_groupwise_user
tag: default
......@@ -52,5 +52,5 @@ display:
id: default
position: '0'
human_name: ''
name: test_plugin_argument_default_current_user
id: test_plugin_argument_default_current_user
tag: ''
......@@ -49,5 +49,5 @@ display:
id: page_1
position: '0'
human_name: ''
name: test_user_name
id: test_user_name
tag: ''
......@@ -98,5 +98,5 @@ display:
id: default
position: '0'
human_name: test_user_relationship
name: test_user_relationship
id: test_user_relationship
tag: default
......@@ -23,4 +23,4 @@ display:
id: default
position: '0'
human_name:
name: test_user_uid_argument
id: test_user_uid_argument
......@@ -33,5 +33,5 @@ display:
id: default
position: '0'
human_name: ''
name: test_view_argument_validate_user
id: test_view_argument_validate_user
tag: ''
......@@ -46,5 +46,5 @@ display:
id: default
position: '0'
human_name: test_views_handler_field_user_name
name: test_views_handler_field_user_name
id: test_views_handler_field_user_name
tag: default
disabled: true
api_version: '3.0'
module: node
name: archive
id: archive
description: 'A list of months that link to content for that month.'
tag: default
base_table: node
......
disabled: true
api_version: '3.0'
module: search
name: backlinks
id: backlinks
description: 'A list of other content items which have a link to the content item.'
tag: default
base_table: node
......
disabled: true
api_version: '3.0'
module: comment
name: comments_recent
id: comments_recent
description: 'A block and a page with recent comments.'
tag: default
base_table: comment
......
disabled: true
api_version: '3.0'
module: node
name: frontpage
id: frontpage
description: 'Emulates the default Drupal front page; you may set the default home page path to this view to make it your front page.'
tag: default
base_table: node
......
disabled: true
api_version: '3.0'
module: node
name: glossary
id: glossary
description: 'A list of all content, by letter.'
tag: default
base_table: node
......
disabled: true
api_version: '3.0'
module: taxonomy
name: taxonomy_term
id: taxonomy_term
description: 'Customize the default taxonomy/term display.'
tag: default
base_table: node
......
disabled: true
api_version: '3.0'
module: node
name: tracker
id: tracker
description: 'Shows all new activity on the system.'
tag: default
base_table: node
......
......@@ -208,7 +208,7 @@ function views_ajax_command_replace_title($title) {
$command = array(
'command' => 'viewsReplaceTitle',
'title' => $title,
'siteName' => config('system.site')->get('name'),
'siteName' => config('system.site')->id(),
);
return $command;
}
......
......@@ -32,7 +32,7 @@
* config_prefix = "views.view",
* fieldable = FALSE,
* entity_keys = {
* "id" = "name",
* "id" = "id",
* "label" = "human_name",
* "uuid" = "uuid"
* }
......@@ -48,11 +48,11 @@ class View extends ConfigEntityBase implements ViewStorageInterface {
protected $base_table = 'node';
/**
* The name of the view.
* The unique ID of the view.
*
* @var string
*/
public $name = NULL;
public $id = NULL;
/**
* The description of the view, which is used only in the interface.
......@@ -161,13 +161,6 @@ public function uri() {
);
}
/**
* Overrides Drupal\Core\Entity\EntityInterface::id().
*/
public function id() {
return $this->get('name');
}
/**
* Overrides Drupal\Core\Config\Entity\ConfigEntityBase::createDuplicate().
*/
......@@ -207,7 +200,7 @@ public function isEnabled() {
*/
public function getHumanName() {
if (!$human_name = $this->get('human_name')) {
$human_name = $this->get('name');
$human_name = $this->id();
}
return $human_name;
}
......@@ -405,7 +398,7 @@ public function getExportProperties() {
'display',
'human_name',
'module',
'name',
'id',
'tag',
'uuid',
);
......
......@@ -49,7 +49,7 @@ public function getDerivativeDefinitions(array $base_plugin_definition) {
foreach ($executable->displayHandlers as $display) {
// Add a block plugin definition for each block display.
if (isset($display) && !empty($display->definition['uses_hook_block'])) {
$delta = $view->get('name') . '-' . $display->display['id'];
$delta = $view->id() . '-' . $display->display['id'];
$desc = $display->getOption('block_description');
if (empty($desc)) {
......
......@@ -50,8 +50,8 @@ public function getDerivativeDefinitions(array $base_plugin_definition) {
if (isset($display) && $display->getOption('exposed_block')) {
// Add a block definition for the block.
if ($display->usesExposedFormInBlock()) {
$delta = $view->get('name') . '-' . $display->display['id'];
$desc = t('Exposed form: @view-@display_id', array('@view' => $view->get('name'), '@display_id' => $display->display['id']));
$delta = $view->id() . '-' . $display->display['id'];
$desc = t('Exposed form: @view-@display_id', array('@view' => $view->id(), '@display_id' => $display->display['id']));
$this->derivatives[$delta] = array(
'subject' => $desc,
'cache' => DRUPAL_NO_CACHE,
......
......@@ -821,7 +821,7 @@ public function getEntityType() {
return $views_data['table']['entity type'];
}
else {
throw new \Exception(format_string('No entity type for field @field on view @view', array('@field' => $this->options['id'], '@view' => $this->view->storage->get('name'))));
throw new \Exception(format_string('No entity type for field @field on view @view', array('@field' => $this->options['id'], '@view' => $this->view->storage->id())));
}
}
......
......@@ -35,7 +35,7 @@ protected function defineOptions() {
public function buildOptionsForm(&$form, &$form_state) {
parent::buildOptionsForm($form, $form_state);
$view_display = $this->view->storage->get('name') . ':' . $this->view->current_display;
$view_display = $this->view->storage->id() . ':' . $this->view->current_display;
$options = array('' => t('-Select-'));
$options += views_get_views_as_options(FALSE, 'all', $view_display, FALSE, TRUE);
......
......@@ -180,7 +180,7 @@ function cache_get($type) {
* to be sure that we catch everything. Maybe that's a bad idea.
*/
function cache_flush() {
cache($this->table)->deleteTags(array($this->view->storage->get('name') => TRUE));
cache($this->table)->deleteTags(array($this->view->storage->id() => TRUE));
}
/**
......@@ -295,7 +295,7 @@ public function generateResultsKey() {
}
}
$this->resultsKey = $this->view->storage->get('name') . ':' . $this->displayHandler->display['id'] . ':results:' . hash('sha256', serialize($key_data));
$this->resultsKey = $this->view->storage->id() . ':' . $this->displayHandler->display['id'] . ':results:' . hash('sha256', serialize($key_data));
}
return $this->resultsKey;
......@@ -319,7 +319,7 @@ public function generateOutputKey() {
'base_url' => $GLOBALS['base_url'],
);
$this->outputKey = $this->view->storage->get('name') . ':' . $this->displayHandler->display['id'] . ':output:' . hash('sha256', serialize($key_data));
$this->outputKey = $this->view->storage->id() . ':' . $this->displayHandler->display['id'] . ':output:' . hash('sha256', serialize($key_data));
}
return $this->outputKey;
......
......@@ -977,7 +977,7 @@ public function optionLink($text, $section, $class = '', $title = '') {
$title = $text;
}
return l($text, 'admin/structure/views/nojs/display/' . $this->view->storage->get('name') . '/' . $this->display['id'] . '/' . $section, array('attributes' => array('class' => 'views-ajax-link ' . $class, 'title' => $title, 'id' => drupal_html_id('views-' . $this->display['id'] . '-' . $section)), 'html' => TRUE));
return l($text, 'admin/structure/views/nojs/display/' . $this->view->storage->id() . '/' . $this->display['id'] . '/' . $section, array('attributes' => array('class' => 'views-ajax-link ' . $class, 'title' => $title, 'id' => drupal_html_id('views-' . $this->display['id'] . '-' . $section)), 'html' => TRUE));
}
/**
......@@ -2627,8 +2627,8 @@ public function getSpecialBlocks() {
$blocks = array();
if ($this->usesExposedFormInBlock()) {
$delta = '-exp-' . $this->view->storage->get('name') . '-' . $this->display['id'];
$desc = t('Exposed form: @view-@display_id', array('@view' => $this->view->storage->get('name'), '@display_id' => $this->display['id']));
$delta = '-exp-' . $this->view->storage->id() . '-' . $this->display['id'];
$desc = t('Exposed form: @view-@display_id', array('@view' => $this->view->storage->id(), '@display_id' => $this->display['id']));
$blocks[$delta] = array(
'info' => $desc,
......
......@@ -41,7 +41,7 @@ public function executeHookMenu($callbacks) {
// views_arg_load -- which lives in views.module.
$bits = explode('/', $this->getOption('path'));
$page_arguments = array($this->view->storage->name, $this->display['id']);
$page_arguments = array($this->view->storage->id(), $this->display['id']);
$this->view->initHandlers();
$view_arguments = $this->view->argument;
......@@ -103,7 +103,7 @@ public function executeHookMenu($callbacks) {
'access callback' => 'views_access',
'access arguments' => $access_arguments,
// Identify URL embedded arguments and correlate them to a handler.
'load arguments' => array($this->view->storage->name, $this->display['id'], '%index'),
'load arguments' => array($this->view->storage->id(), $this->display['id'], '%index'),
);
$menu = $this->getOption('menu');
if (empty($menu)) {
......@@ -165,7 +165,7 @@ public function executeHookMenu($callbacks) {
'access arguments' => $access_arguments,
// Identify URL embedded arguments and correlate them to a
// handler.
'load arguments' => array($this->view->storage->name, $this->display['id'], '%index'),
'load arguments' => array($this->view->storage->id(), $this->display['id'], '%index'),
'title' => $tab_options['title'],
'description' => $tab_options['description'],
'menu_name' => $tab_options['name'],
......
......@@ -284,8 +284,8 @@ function reset_form(&$form, &$form_state) {
// remember settings.
$display_id = ($this->view->display_handler->isDefaulted('filters')) ? 'default' : $this->view->current_display;
if (isset($_SESSION['views'][$this->view->storage->get('name')][$display_id])) {
unset($_SESSION['views'][$this->view->storage->get('name')][$display_id]);
if (isset($_SESSION['views'][$this->view->storage->id()][$display_id])) {
unset($_SESSION['views'][$this->view->storage->id()][$display_id]);
}
// Set the form to allow redirect.
......
......@@ -1611,19 +1611,19 @@ public function themeFunctions() {
$display = $this->view->display_handler->display;
if (!empty($display)) {
$themes[] = $hook . '__' . $this->view->storage->get('name') . '__' . $display['id'] . '__' . $this->options['id'];
$themes[] = $hook . '__' . $this->view->storage->get('name') . '__' . $display['id'];
$themes[] = $hook . '__' . $this->view->storage->id() . '__' . $display['id'] . '__' . $this->options['id'];
$themes[] = $hook . '__' . $this->view->storage->id() . '__' . $display['id'];
$themes[] = $hook . '__' . $display['id'] . '__' . $this->options['id'];
$themes[] = $hook . '__' . $display['id'];
if ($display['id'] != $display['display_plugin']) {
$themes[] = $hook . '__' . $this->view->storage->get('name') . '__' . $display['display_plugin'] . '__' . $this->options['id'];
$themes[] = $hook . '__' . $this->view->storage->get('name') . '__' . $display['display_plugin'];
$themes[] = $hook . '__' . $this->view->storage->id() . '__' . $display['display_plugin'] . '__' . $this->options['id'];
$themes[] = $hook . '__' . $this->view->storage->id() . '__' . $display['display_plugin'];
$themes[] = $hook . '__' . $display['display_plugin'] . '__' . $this->options['id'];
$themes[] = $hook . '__' . $display['display_plugin'];
}
}
$themes[] = $hook . '__' . $this->view->storage->get('name') . '__' . $this->options['id'];
$themes[] = $hook . '__' . $this->view->storage->get('name');
$themes[] = $hook . '__' . $this->view->storage->id() . '__' . $this->options['id'];
$themes[] = $hook . '__' . $this->view->storage->id();
$themes[] = $hook . '__' . $this->options['id'];
$themes[] = $hook;
......
......@@ -1244,8 +1244,8 @@ function store_group_input($input, $status) {
// false means that we got a setting that means to recuse ourselves,
// so we should erase whatever happened to be there.
if ($status === FALSE && isset($_SESSION['views'][$this->view->storage->get('name')][$display_id])) {
$session = &$_SESSION['views'][$this->view->storage->get('name')][$display_id];
if ($status === FALSE && isset($_SESSION['views'][$this->view->storage->id()][$display_id])) {
$session = &$_SESSION['views'][$this->view->storage->id()][$display_id];
if (isset($session[$this->options['group_info']['identifier']])) {
unset($session[$this->options['group_info']['identifier']]);
......@@ -1253,11 +1253,11 @@ function store_group_input($input, $status) {
}
if ($status !== FALSE) {
if (!isset($_SESSION['views'][$this->view->storage->get('name')][$display_id])) {
$_SESSION['views'][$this->view->storage->get('name')][$display_id] = array();
if (!isset($_SESSION['views'][$this->view->storage->id()][$display_id])) {
$_SESSION['views'][$this->view->storage->id()][$display_id] = array();
}
$session = &$_SESSION['views'][$this->view->storage->get('name')][$display_id];
$session = &$_SESSION['views'][$this->view->storage->id()][$display_id];
$session[$this->options['group_info']['identifier']] = $input[$this->options['group_info']['identifier']];
}
......@@ -1338,8 +1338,8 @@ public function storeExposedInput($input, $status) {
// false means that we got a setting that means to recuse ourselves,
// so we should erase whatever happened to be there.
if (!$status && isset($_SESSION['views'][$this->view->storage->get('name')][$display_id])) {
$session = &$_SESSION['views'][$this->view->storage->get('name')][$display_id];
if (!$status && isset($_SESSION['views'][$this->view->storage->id()][$display_id])) {
$session = &$_SESSION['views'][$this->view->storage->id()][$display_id];
if ($operator && isset($session[$this->options['expose']['operator_id']])) {
unset($session[$this->options['expose']['operator_id']]);
}
......@@ -1350,11 +1350,11 @@ public function storeExposedInput($input, $status) {
}
if ($status) {
if (!isset($_SESSION['views'][$this->view->storage->get('name')][$display_id])) {
$_SESSION['views'][$this->view->storage->get('name')][$display_id] = array();
if (!isset($_SESSION['views'][$this->view->storage->id()][$display_id])) {
$_SESSION['views'][$this->view->storage->id()][$display_id] = array();
}
$session = &$_SESSION['views'][$this->view->storage->get('name')][$display_id];
$session = &$_SESSION['views'][$this->view->storage->id()][$display_id];
if ($operator && isset($input[$this->options['expose']['operator_id']])) {
$session[$this->options['expose']['operator_id']] = $input[$this->options['expose']['operator_id']];
......
......@@ -1283,7 +1283,7 @@ public function query($get_count = FALSE) {
$query = Database::getConnection($target, $key)
->select($this->view->storage->get('base_table'), $this->view->storage->get('base_table'), $options)
->addTag('views')
->addTag('views_' . $this->view->storage->get('name'));
->addTag('views_' . $this->view->storage->id());
// Add the tags added to the view itself.
foreach ($this->tags as $tag) {
......@@ -1514,7 +1514,7 @@ function execute(ViewExecutable $view) {
drupal_set_message($e->getMessage(), 'error');
}
else {
throw new DatabaseExceptionWrapper(format_string('Exception in @human_name[@view_name]: @message', array('@human_name' => $view->storage->getHumanName(), '@view_name' => $view->storage->get('name'), '@message' => $e->getMessage())));
throw new DatabaseExceptionWrapper(format_string('Exception in @human_name[@view_name]: @message', array('@human_name' => $view->storage->getHumanName(), '@view_name' => $view->storage->id(), '@message' => $e->getMessage())));
}
}
......@@ -1646,7 +1646,7 @@ function load_entities(&$results) {
}
function add_signature(ViewExecutable $view) {
$view->query->add_field(NULL, "'" . $view->storage->get('name') . ':' . $view->current_display . "'", 'view_name');
$view->query->add_field(NULL, "'" . $view->storage->id() . ':' . $view->current_display . "'", 'view_name');
}
function get_aggregation_info() {
......
......@@ -132,10 +132,10 @@ public function buildOptionsForm(&$form, &$form_state) {
// TODO: check the field is the correct sort?
// or let users hang themselves at this stage and check later?
if ($view->type == 'Default') {
$views[t('Default Views')][$view->storage->get('name')] = $view->storage->get('name');
$views[t('Default Views')][$view->storage->id()] = $view->storage->id();
}
else {
$views[t('Existing Views')][$view->storage->get('name')] = $view->storage->get('name');
$views[t('Existing Views')][$view->storage->id()] = $view->storage->id();
}
}
}
......@@ -171,7 +171,7 @@ function get_temporary_view() {
* When the form is submitted, take sure to clear the subquery string cache.
*/
public function submitOptionsForm(&$form, &$form_state) {
$cid = 'views_relationship_groupwise_max:' . $this->view->storage->get('name') . ':' . $this->view->current_display . ':' . $this->options['id'];
$cid = 'views_relationship_groupwise_max:' . $this->view->storage->id() . ':' . $this->view->current_display . ':' . $this->options['id'];
cache('views_results')->delete($cid);
}
......@@ -362,7 +362,7 @@ public function query() {
}
else {
// Get the stored subquery SQL string.
$cid = 'views_relationship_groupwise_max:' . $this->view->storage->get('name') . ':' . $this->view->current_display . ':' . $this->options['id'];
$cid = 'views_relationship_groupwise_max:' . $this->view->storage->id() . ':' . $this->view->current_display . ':' . $this->options['id'];
$cache = cache('views_results')->get($cid);
if (isset($cache->data)) {
$def['left_query'] = $cache->data;
......
......@@ -621,7 +621,7 @@ protected function build_sorts(&$form, &$form_state) {
protected function instantiate_view($form, &$form_state) {
// Build the basic view properties and create the view.
$values = array(
'name' => $form_state['values']['name'],