We should deprecate the use of views_get_view, as that requires views.module to be loaded etc.. and that just isn't the direction we are heading in. We should mark that as deprecated and use a helper method on our Drupal\views\Views class instead. This can load directly from the storage controller and return an instance, similar to now.

Comments

dawehner’s picture

Status: Needs review » Needs work
+++ b/core/modules/views/lib/Drupal/views/Views.phpundefined
@@ -75,4 +75,20 @@ public static function handlerManager($type) {
+   * @return Drupal\views\ViewExecutable

Missing "\"

+++ b/core/modules/views/lib/Drupal/views/Views.phpundefined
@@ -75,4 +75,20 @@ public static function handlerManager($type) {
+    if ($view) {
+      return $view->get('executable');

Use the view.executable service to get an executable.

damiankloip’s picture

Status: Needs work » Needs review
StatusFileSize
new783 bytes
new1.31 KB

You're totally right, thanks.

damiankloip’s picture

StatusFileSize
new2.13 KB
new3.47 KB

Did some unit tests too.

tim.plunkett’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +RTBC July 1

Wonderful.

damiankloip’s picture

StatusFileSize
new3.57 KB

reroll.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed d8e21f8 and pushed to 8.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

xjm’s picture

Title: Deprecate use of views_get_view function in favour of Views::getView() method » [Change notice] Deprecate use of views_get_view function in favour of Views::getView() method
Project: Drupal core » Views (for Drupal 7)
Version: 8.x-dev » 8.x-3.x-dev
Component: views.module » Code
Issue tags: +API change, +Needs change record

Change record needed. :)