Articles


[SOLVED] Notice: Undefined property: view::$dom_id in template_preprocess_views_view()

[SOLVED] Notice: Undefined property: view::$dom_id in template_preprocess_views_view()



Posted byJibin Jose,24th Nov 2016

For one of the Drupal site, we are calling a view block programmatically to render inside a particular region. On checking the code we couldn't found any issue as the DPM is printing the view block Html properly for us, also the view result as the same what we are expecting from the view block also.

Inside the preprocess_page we are calling the view block. The below code snippets are used to call the view block.


$view = views_get_view('strokes');
$view->set_display('strokes');
$view->execute(); 
variable['my_variable'] = $view->render();

The result with show a notice as like "Notice: Undefined property: view::$dom_id in template_preprocess_views_view()"

In order to remove the remove the Notice: Undefined property: view::$dom_id in template_preprocess_views_view()

A small change inside the code will remove the Notice for the Drupal Site

variable['my_variable'] = $view->render();

to:

variable['my_variable'] = $view->preview();;

The above code snippet will remove the unwanted notice from the Drupal 7 Site.

If you believe you need any further assistance, please feel free to contact us via mail on [email protected]

Categories