You are here

protected function views_lazy_load_plugin_display_extender::addLoadingArea in Views Lazy Load 7

Same name and namespace in other branches
  1. 8 includes/views/views_lazy_load_plugin_display_extender.inc \views_lazy_load_plugin_display_extender::addLoadingArea()

Add a loading div to the view while we're loading the results.

1 call to views_lazy_load_plugin_display_extender::addLoadingArea()
views_lazy_load_plugin_display_extender::pre_execute in includes/views/views_lazy_load_plugin_display_extender.inc
Set up any variables on the view prior to execution.

File

includes/views/views_lazy_load_plugin_display_extender.inc, line 123
A display extender plugin for lazy loading a view.

Class

views_lazy_load_plugin_display_extender
@file A display extender plugin for lazy loading a view.

Code

protected function addLoadingArea() {

  // Add a empty area plugin to this view display so it gets initialised.
  $display_id = $this->display->display->id;
  $handler_id = $this->view
    ->add_item($display_id, 'empty', 'views', 'area', array(
    'empty' => TRUE,
    'format' => 'full_html',
    'content' => theme('views_lazy_load_throbber'),
  ));

  // Now get the area plugin info back and initialise an area plugin.
  $empty_info = $this->display
    ->get_option('empty');
  $area = views_get_handler('views', 'area', 'area');
  $area
    ->init($this->view, $empty_info[$handler_id]);

  // We must add the area directly to the display_handler to make sure it gets
  // rendered.
  $this->display->handlers['empty'][$handler_id] = $area;
}