Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
294
Merge Requests
294
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
97969786
Commit
97969786
authored
Dec 08, 2012
by
webchick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#1858054
by tim.plunkett, dawehner: Remove ViewExecutable::cloneView().
parent
c437f67d
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
14 additions
and
46 deletions
+14
-46
core/modules/views/lib/Drupal/views/Plugin/views/display/Attachment.php
...iews/lib/Drupal/views/Plugin/views/display/Attachment.php
+2
-5
core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php
...b/Drupal/views/Plugin/views/display/DisplayPluginBase.php
+1
-1
core/modules/views/lib/Drupal/views/Plugin/views/display/Feed.php
...ules/views/lib/Drupal/views/Plugin/views/display/Feed.php
+1
-2
core/modules/views/lib/Drupal/views/ViewExecutable.php
core/modules/views/lib/Drupal/views/ViewExecutable.php
+3
-16
core/modules/views/views.module
core/modules/views/views.module
+6
-20
core/modules/views/views_ui/admin.inc
core/modules/views/views_ui/admin.inc
+1
-2
No files found.
core/modules/views/lib/Drupal/views/Plugin/views/display/Attachment.php
View file @
97969786
...
...
@@ -7,6 +7,7 @@
namespace
Drupal\views\Plugin\views\display
;
use
Drupal\views\ViewExecutable
;
use
Drupal\Core\Annotation\Plugin
;
use
Drupal\Core\Annotation\Translation
;
...
...
@@ -230,7 +231,7 @@ public function submitOptionsForm(&$form, &$form_state) {
/**
* Attach to another view.
*/
public
function
attachTo
(
$display_id
)
{
public
function
attachTo
(
ViewExecutable
$view
,
$display_id
)
{
$displays
=
$this
->
getOption
(
'displays'
);
if
(
empty
(
$displays
[
$display_id
]))
{
...
...
@@ -241,10 +242,6 @@ public function attachTo($display_id) {
return
;
}
// Get a fresh view because our current one has a lot of stuff on it because it's
// already been executed.
$view
=
$this
->
view
->
cloneView
();
$args
=
$this
->
getOption
(
'inherit_arguments'
)
?
$this
->
view
->
args
:
array
();
$view
->
setArguments
(
$args
);
$view
->
setDisplay
(
$this
->
display
[
'id'
]);
...
...
core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php
View file @
97969786
...
...
@@ -380,7 +380,7 @@ public function usesAreas() {
/**
* Allow displays to attach to other views.
*/
public
function
attachTo
(
$display_id
)
{
}
public
function
attachTo
(
ViewExecutable
$view
,
$display_id
)
{
}
/**
* Static member function to list which sections are defaultable
...
...
core/modules/views/lib/Drupal/views/Plugin/views/display/Feed.php
View file @
97969786
...
...
@@ -244,7 +244,7 @@ public function submitOptionsForm(&$form, &$form_state) {
/**
* Overrides \Drupal\views\Plugin\views\display\DisplayPluginBase::attachTo().
*/
public
function
attachTo
(
$display_id
)
{
public
function
attachTo
(
ViewExecutable
$clone
,
$display_id
)
{
$displays
=
$this
->
getOption
(
'displays'
);
if
(
empty
(
$displays
[
$display_id
]))
{
return
;
...
...
@@ -254,7 +254,6 @@ public function attachTo($display_id) {
// attach a feed icon.
$plugin
=
$this
->
getPlugin
(
'style'
);
if
(
$plugin
)
{
$clone
=
$this
->
view
->
cloneView
();
$clone
->
setDisplay
(
$this
->
display
[
'id'
]);
$clone
->
buildTitle
();
$plugin
->
attach_to
(
$display_id
,
$this
->
getPath
(),
$clone
->
getTitle
());
...
...
core/modules/views/lib/Drupal/views/ViewExecutable.php
View file @
97969786
...
...
@@ -1492,7 +1492,9 @@ public function attachDisplays() {
// Give other displays an opportunity to attach to the view.
foreach
(
$this
->
displayHandlers
as
$id
=>
$display
)
{
if
(
!
empty
(
$this
->
displayHandlers
[
$id
]))
{
$this
->
displayHandlers
[
$id
]
->
attachTo
(
$this
->
current_display
);
// Create a clone for the attachments to manipulate. 'static' refers to the current class name.
$cloned_view
=
new
static
(
$this
->
storage
);
$this
->
displayHandlers
[
$id
]
->
attachTo
(
$cloned_view
,
$this
->
current_display
);
}
}
$this
->
is_attachment
=
FALSE
;
...
...
@@ -1831,21 +1833,6 @@ public function createDuplicate() {
return
entity_create
(
'view'
,
$data
);
}
/**
* Safely clone a view.
*
* This will completely wipe a view clean so it can be considered fresh.
*
* @return Drupal\views\ViewExecutable
* The cloned view.
*/
public
function
cloneView
()
{
$storage
=
clone
$this
->
storage
;
$executable
=
new
ViewExecutable
(
$storage
);
$storage
->
set
(
'executable'
,
$executable
);
return
$executable
;
}
/**
* Unset references so that a $view object may be properly garbage
* collected.
...
...
core/modules/views/views.module
View file @
97969786
...
...
@@ -479,11 +479,6 @@ function views_menu_alter(&$callbacks) {
$our_paths
[
$path
]
=
TRUE
;
}
}
}
// Save memory: Destroy those views.
foreach
(
$views
as
$data
)
{
list
(
$view
,
$display_id
)
=
$data
;
$view
->
destroy
();
}
}
...
...
@@ -1411,21 +1406,12 @@ function views_get_applicable_views($type) {
continue
;
}
// Loop on array keys because something seems to muck with $view->display
// a bit in PHP4.
foreach
(
array_keys
(
$display
)
as
$id
)
{
$plugin
=
drupal_container
()
->
get
(
'plugin.manager.views.display'
)
->
getDefinition
(
$display
[
$id
][
'display_plugin'
]);
if
(
!
empty
(
$plugin
[
$type
]))
{
// This view uses_hook_menu. Clone it so that different handlers
// don't trip over each other, and add it to the list.
$v
=
$view
->
get
(
'executable'
)
->
cloneView
();
if
(
$v
->
setDisplay
(
$id
)
&&
$v
->
display_handler
->
isEnabled
())
{
$result
[]
=
array
(
$v
,
$id
);
}
// In PHP 4.4.7 and presumably earlier, if we do not unset $v
// here, we will find that it actually overwrites references
// possibly due to shallow copying issues.
unset
(
$v
);
// Check each display to see if it meets the criteria and is enabled.
$executable
=
$view
->
get
(
'executable'
);
$executable
->
setDisplay
();
foreach
(
$executable
->
displayHandlers
as
$id
=>
$handler
)
{
if
(
!
empty
(
$handler
->
definition
[
$type
])
&&
$handler
->
isEnabled
())
{
$result
[]
=
array
(
$executable
,
$id
);
}
}
}
...
...
core/modules/views/views_ui/admin.inc
View file @
97969786
...
...
@@ -1460,8 +1460,7 @@ function views_ui_config_item_form($form, &$form_state) {
// We want this relationship option to get saved even if the user
// skips submitting the form.
$executable
->
setItemOption
(
$display_id
,
$type
,
$id
,
'relationship'
,
$rel
);
$temp_view
=
$view
->
cloneView
();
views_ui_cache_set
(
$temp_view
);
views_ui_cache_set
(
$view
);
}
$form
[
'options'
][
'relationship'
]
=
array
(
...
...
Write
Preview
Markdown
is supported
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