Commit 0db67ce1 authored by Remon Georgy's avatar Remon Georgy

Fix issue #821184

parent e29ec948
......@@ -4,7 +4,7 @@
* @file
* Theme infinite scroll page
*/
function theme_views_infinite_scroll_pager($tags = array(), $limit = 10, $element = 0, $parameters = array(), $quantity = 9) {
function theme_views_infinite_scroll_pager($tags = array(), $limit = 10, $content_selector = 'div.view-content', $items_selector = 'div.view-content .views-row', $element = 0, $parameters = array(), $quantity = 9) {
$PAGER_CLASS = 'pager';
global $pager_page_array, $pager_total;
......@@ -33,11 +33,13 @@ function theme_views_infinite_scroll_pager($tags = array(), $limit = 10, $elemen
'class' => 'pager-next',
'data' => $li_next,
);
$settings = array(
'views_infinite_scroll' => array(
'pager_selector' => 'ul.' . $PAGER_CLASS,
'next_selector' => 'li.pager-next a:first',
'content_selector' => 'div.view-content',
'content_selector' => $content_selector,
'items_selector' => $items_selector,
)
);
drupal_add_js($settings, 'setting' );
......
......@@ -7,7 +7,7 @@
* Implementation of hook_views_api().
*/
function views_infinite_scroll_views_api() {
return array('api' => 2);
return array('api' => '3.0-alpha1');
}
/**
......
......@@ -20,7 +20,29 @@ class views_plugin_pager_infinite_scroll extends views_plugin_pager_full {
}
function render($input) {
$style_plugin = $this->view->display_handler->default_display->options['style_plugin'];
$content_selector = '';
$items_selector = '';
switch($style_plugin){
case 'default':
$content_selector = 'div.view-content';
$items_selector = 'div.view-content .views-row';
break;
case 'grid':
$content_selector = 'div.view-content tbody';
$items_selector = 'div.view-content tbody tr';
break;
case 'list':
$content_selector = 'div.view-content .item-list > *';
$items_selector = 'div.view-content .views-row';
break;
case 'table':
$content_selector = 'div.view-content tbody';
$items_selector = 'div.view-content tbody tr';
break;
}
$pager_theme = views_theme_functions('views_infinite_scroll_pager', $this->view, $this->display);
return theme($pager_theme, $input, $this->options['items_per_page'], $this->options['id']);
return theme($pager_theme, $input, $this->options['items_per_page'], $content_selector, $items_selector, $this->options['id']);
}
}
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