Commit 8d7c0ffe authored by catch's avatar catch

Issue #2641626 by Mac_Weber, heykarthikwithu, naveenvalecha: Replace...

Issue #2641626 by Mac_Weber, heykarthikwithu, naveenvalecha: Replace deprecated usage of  entity_create('view') with a direct call to View::create()
parent 3f6c9742
......@@ -10,6 +10,7 @@
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 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
* 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();
}
......
......@@ -660,7 +660,7 @@ protected function instantiateView($form, FormStateInterface $form_state) {
'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);
......
......@@ -11,6 +11,7 @@
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 @@ public function testHandlers() {
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.
......
......@@ -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 @@ public function testReadMore() {
$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.');
}
......
......@@ -10,6 +10,7 @@
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 @@ public function testViewsUiAutocompleteTag() {
$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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment