summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathaniel Catchpole2016-02-15 07:56:24 (GMT)
committerNathaniel Catchpole2016-02-15 07:56:24 (GMT)
commit8d7c0ffefdb777114d76b62d96a16fccf8b12307 (patch)
tree113ed3d1f8ff194541866d5ef15f9bbd2859e7a8
parent3f6c97421c8c851d268342c4a9da8d97163c6857 (diff)
Issue #2641626 by Mac_Weber, heykarthikwithu, naveenvalecha: Replace deprecated usage of entity_create('view') with a direct call to View::create()
-rw-r--r--core/modules/views/src/Plugin/views/relationship/GroupwiseMax.php3
-rw-r--r--core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php2
-rw-r--r--core/modules/views/src/Tests/Handler/HandlerAllTest.php3
-rw-r--r--core/modules/views/src/Tests/Plugin/DisplayTest.php3
-rw-r--r--core/modules/views_ui/src/Tests/TagTest.php3
5 files changed, 9 insertions, 5 deletions
diff --git a/core/modules/views/src/Plugin/views/relationship/GroupwiseMax.php b/core/modules/views/src/Plugin/views/relationship/GroupwiseMax.php
index 52b1ff7..0aae903 100644
--- a/core/modules/views/src/Plugin/views/relationship/GroupwiseMax.php
+++ b/core/modules/views/src/Plugin/views/relationship/GroupwiseMax.php
@@ -10,6 +10,7 @@ namespace Drupal\views\Plugin\views\relationship;
use Drupal\Core\Database\Query\AlterableInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\views\Views;
+use Drupal\views\Entity\View;
/**
* Relationship handler that allows a groupwise maximum of the linked in table.
@@ -156,7 +157,7 @@ class GroupwiseMax extends RelationshipPluginBase {
* We use this to obtain our subquery SQL.
*/
protected function getTemporaryView() {
- $view = entity_create('view', array('base_table' => $this->definition['base']));
+ $view = View::create(array('base_table' => $this->definition['base']));
$view->addDisplay('default');
return $view->getExecutable();
}
diff --git a/core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php b/core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php
index 95acc95..bb0aff8 100644
--- a/core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php
+++ b/core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php
@@ -660,7 +660,7 @@ abstract class WizardPluginBase extends PluginBase implements WizardInterface {
'langcode' => \Drupal::languageManager()->getDefaultLanguage()->getId(),
);
- $view = entity_create('view', $values);
+ $view = View::create($values);
// Build all display options for this view.
$display_options = $this->buildDisplayOptions($form, $form_state);
diff --git a/core/modules/views/src/Tests/Handler/HandlerAllTest.php b/core/modules/views/src/Tests/Handler/HandlerAllTest.php
index 84579a8..4c321a8 100644
--- a/core/modules/views/src/Tests/Handler/HandlerAllTest.php
+++ b/core/modules/views/src/Tests/Handler/HandlerAllTest.php
@@ -11,6 +11,7 @@ use Drupal\comment\Tests\CommentTestTrait;
use Drupal\views\ViewExecutable;
use Drupal\views\Plugin\views\HandlerBase;
use Drupal\views\Plugin\views\filter\InOperator;
+use Drupal\views\Entity\View;
/**
* Tests instances of all handlers.
@@ -59,7 +60,7 @@ class HandlerAllTest extends HandlerTestBase {
continue;
}
- $view = entity_create('view', array('base_table' => $base_table));
+ $view = View::create(array('base_table' => $base_table));
$view = $view->getExecutable();
// @todo The groupwise relationship is currently broken.
diff --git a/core/modules/views/src/Tests/Plugin/DisplayTest.php b/core/modules/views/src/Tests/Plugin/DisplayTest.php
index 0517063..cae25a9 100644
--- a/core/modules/views/src/Tests/Plugin/DisplayTest.php
+++ b/core/modules/views/src/Tests/Plugin/DisplayTest.php
@@ -8,6 +8,7 @@
namespace Drupal\views\Tests\Plugin;
use Drupal\language\Entity\ConfigurableLanguage;
+use Drupal\views\Entity\View;
use Drupal\views\Views;
use Drupal\views_test_data\Plugin\views\display\DisplayTest as DisplayTestPlugin;
@@ -230,7 +231,7 @@ class DisplayTest extends PluginTestBase {
$this->assertTrue(empty($result), 'The more link is not shown when view has more records.');
// Test the default value of use_more_always.
- $view = entity_create('view')->getExecutable();
+ $view = View::create()->getExecutable();
$this->assertTrue($view->getDisplay()->getOption('use_more_always'), 'Always display the more link by default.');
}
diff --git a/core/modules/views_ui/src/Tests/TagTest.php b/core/modules/views_ui/src/Tests/TagTest.php
index b18ee98..ffb6077 100644
--- a/core/modules/views_ui/src/Tests/TagTest.php
+++ b/core/modules/views_ui/src/Tests/TagTest.php
@@ -10,6 +10,7 @@ namespace Drupal\views_ui\Tests;
use Drupal\views\Tests\ViewKernelTestBase;
use Drupal\views_ui\Controller\ViewsUIController;
use Drupal\Component\Utility\Html;
+use Drupal\views\Entity\View;
/**
* Tests the views ui tagging functionality.
@@ -37,7 +38,7 @@ class TagTest extends ViewKernelTestBase {
$suffix = $i % 2 ? 'odd' : 'even';
$tag = 'autocomplete_tag_test_' . $suffix . $this->randomMachineName();
$tags[] = $tag;
- entity_create('view', array('tag' => $tag, 'id' => $this->randomMachineName()))->save();
+ View::create(array('tag' => $tag, 'id' => $this->randomMachineName()))->save();
}
// Make sure just ten results are returns.