updated view_send, vews_php, nodeformcols, email_registratio

This commit is contained in:
Bachir Soussi Chiadmi
2016-11-05 16:53:56 +01:00
parent 0bb339fc99
commit 3b6c7b914d
20 changed files with 318 additions and 130 deletions

View File

@@ -225,8 +225,13 @@ class views_php_handler_field extends views_handler_field {
$value = ob_get_clean();
}
else {
$value = check_plain($values->{$this->field_alias});
if (isset($values->{$this->field_alias})) {
$value = check_plain($values->{$this->field_alias});
}
}
if (isset($value)) {
return $value;
}
return $value;
}
}

View File

@@ -47,9 +47,21 @@ class views_php_plugin_pager extends views_php_plugin_wrapper {
}
}
}
$this->update_wrapped_pager();
$this->php_unwrap();
}
protected function update_wrapped_pager() {
$this->wrapped->total_items = count($this->wrapped->view->result);
$this->wrapped->update_page_info();
$item_per_page = $this->wrapped->get_items_per_page();
if ($item_per_page > 0) {
$offset = $this->wrapped->get_current_page() * $item_per_page + $this->wrapped->get_offset();
$this->wrapped->view->result = array_slice($this->wrapped->view->result, $offset, $item_per_page);
}
}
/**
* Execute the count query, which will be done just prior to the query
* itself being executed.

View File

@@ -1,24 +0,0 @@
diff --git a/plugins/views/views_php_plugin_pager.inc b/plugins/views/views_php_plugin_pager.inc
index bb7d2d9..5ffa123 100644
--- a/plugins/views/views_php_plugin_pager.inc
+++ b/plugins/views/views_php_plugin_pager.inc
@@ -47,19 +47,7 @@
}
}
}
- $this->update_wrapped_pager();
$this->php_unwrap();
- }
-
- protected function update_wrapped_pager() {
- $this->wrapped->total_items = count($this->wrapped->view->result);
- $this->wrapped->update_page_info();
-
- $item_per_page = $this->wrapped->get_items_per_page();
- if ($item_per_page > 0) {
- $offset = $this->wrapped->get_current_page() * $item_per_page + $this->wrapped->get_offset();
- $this->wrapped->view->result = array_slice($this->wrapped->view->result, $offset, $item_per_page);
- }
}
/**

View File

@@ -15,9 +15,9 @@ files[] = plugins/views/views_php_plugin_pager.inc
files[] = plugins/views/views_php_plugin_query.inc
files[] = plugins/views/views_php_plugin_wrapper.inc
; Information added by Drupal.org packaging script on 2015-04-21
; Information added by Drupal.org packaging script on 2015-11-13
version = "7.x-2.x-dev"
core = "7.x"
project = "views_php"
datestamp = "1429645983"
datestamp = "1447432844"

View File

@@ -157,3 +157,13 @@ function views_php_views_post_render($view) {
$view->query->php_unwrap();
}
}
/**
* Implements hook_views_post_build().
*/
function views_php_views_post_build($view) {
// Clear the limit and offset
if (!empty($view->views_php) && !empty($view->build_info['query']) && is_object($view->build_info['query'])) {
$view->build_info['query']->range();
}
}