Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
26253b37
Commit
26253b37
authored
Feb 05, 2013
by
catch
Browse files
Issue
#1866910
by damiankloip: Add an ajaxEnabled() method for ViewExecutable.
parent
c962f4f5
Changes
7
Hide whitespace changes
Inline
Side-by-side
core/modules/block/lib/Drupal/block/Plugin/views/display/Block.php
View file @
26253b37
...
...
@@ -176,7 +176,7 @@ public function submitOptionsForm(&$form, &$form_state) {
* Block views use exposed widgets only if AJAX is set.
*/
public
function
usesExposed
()
{
if
(
$this
->
isAJAX
Enabled
())
{
if
(
$this
->
ajax
Enabled
())
{
return
parent
::
usesExposed
();
}
return
FALSE
;
...
...
core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php
View file @
26253b37
...
...
@@ -244,7 +244,7 @@ public function usesAJAX() {
*
* @return bool
*/
public
function
isAJAX
Enabled
()
{
public
function
ajax
Enabled
()
{
if
(
$this
->
usesAJAX
())
{
return
$this
->
getOption
(
'use_ajax'
);
}
...
...
@@ -2488,7 +2488,7 @@ public function access($account = NULL) {
* overridden on an individual display.
*/
public
function
preExecute
()
{
$this
->
view
->
set
UseAJAX
(
$this
->
isAJAX
Enabled
());
$this
->
view
->
set
AjaxEnabled
(
$this
->
ajax
Enabled
());
if
(
$this
->
usesMore
()
&&
!
$this
->
useMoreAlways
())
{
$this
->
view
->
get_total_rows
=
TRUE
;
}
...
...
core/modules/views/lib/Drupal/views/Plugin/views/display/Feed.php
View file @
26253b37
...
...
@@ -33,7 +33,7 @@ class Feed extends PathPluginBase {
*
* @var bool
*/
protected
$
usesAJAX
=
FALSE
;
protected
$
ajaxEnabled
=
FALSE
;
/**
* Whether the display allows the use of a pager or not.
...
...
core/modules/views/lib/Drupal/views/Tests/Plugin/PagerTest.php
View file @
26253b37
...
...
@@ -250,7 +250,8 @@ public function testRenderNullPager() {
}
$view
=
views_get_view
(
'test_pager_full'
);
$this
->
executeView
(
$view
);
$view
->
use_ajax
=
TRUE
;
// force the value again here
// Force the value again here.
$view
->
setAjaxEnabled
(
TRUE
);
$view
->
pager
=
NULL
;
$output
=
$view
->
render
();
$output
=
drupal_render
(
$output
);
...
...
core/modules/views/lib/Drupal/views/Tests/ViewExecutableTest.php
View file @
26253b37
...
...
@@ -57,7 +57,6 @@ class ViewExecutableTest extends ViewUnitTestBase {
'executed'
,
'args'
,
'build_info'
,
'use_ajax'
,
'result'
,
'attachment_before'
,
'attachment_after'
,
...
...
@@ -201,10 +200,10 @@ public function testDisplays() {
public
function
testPropertyMethods
()
{
$view
=
views_get_view
(
'test_executable_displays'
);
// Test the set
UseAJAX
() method.
$this
->
assertFalse
(
$view
->
use_
ajax
);
$view
->
set
UseAJAX
(
TRUE
);
$this
->
assertTrue
(
$view
->
use_
ajax
);
// Test the set
AjaxEnabled
() method.
$this
->
assertFalse
(
$view
->
ajax
Enabled
()
);
$view
->
set
AjaxEnabled
(
TRUE
);
$this
->
assertTrue
(
$view
->
ajax
Enabled
()
);
$view
->
setDisplay
();
// There should be no pager set initially.
...
...
core/modules/views/lib/Drupal/views/ViewExecutable.php
View file @
26253b37
...
...
@@ -67,7 +67,7 @@ class ViewExecutable {
*
* @var bool
*/
p
ublic
$use_ajax
=
FALSE
;
p
rotected
$ajaxEnabled
=
FALSE
;
/**
* Where the results of a query will go.
...
...
@@ -533,12 +533,27 @@ public function usePager() {
}
/**
* Whether or not AJAX should be used. If AJAX is used, paging,
* tablesorting and exposed filters will be fetched via an AJAX call
* rather than a page refresh.
* Sets whether or not AJAX should be used.
*
* If AJAX is used, paging, tablesorting and exposed filters will be fetched
* via an AJAX call rather than a page refresh.
*
* @param bool $use_ajax
* TRUE if AJAX should be used, FALSE otherwise.
*/
public
function
setAjaxEnabled
(
$ajax_enabled
)
{
$this
->
ajaxEnabled
=
(
bool
)
$ajax_enabled
;
}
/**
* Whether or not AJAX should be used.
*
* @see \Drupal\views\ViewExecutable::setAjaxEnabled().
*
* @return bool
*/
public
function
setUseAJAX
(
$use_ajax
)
{
$this
->
use_ajax
=
$use_ajax
;
public
function
ajaxEnabled
(
)
{
return
$this
->
ajaxEnabled
;
}
/**
...
...
core/modules/views/views.theme.inc
View file @
26253b37
...
...
@@ -130,7 +130,7 @@ function template_preprocess_views_view(&$vars) {
}
// If using AJAX, send identifying data about this view.
if
(
$view
->
use_
ajax
&&
empty
(
$view
->
is_attachment
)
&&
empty
(
$view
->
live_preview
))
{
if
(
$view
->
ajax
Enabled
()
&&
empty
(
$view
->
is_attachment
)
&&
empty
(
$view
->
live_preview
))
{
$settings
=
array
(
'views'
=>
array
(
'ajax_path'
=>
url
(
'views/ajax'
),
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment