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
306
Merge Requests
306
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
6b7288fe
Commit
6b7288fe
authored
Aug 27, 2012
by
dawehner
Committed by
tim.plunkett
Oct 21, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use plugin_id instead of type in view::add_display
parent
7f04b598
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
6 deletions
+12
-6
lib/Drupal/views/ViewStorage.php
lib/Drupal/views/ViewStorage.php
+12
-6
No files found.
lib/Drupal/views/ViewStorage.php
View file @
6b7288fe
...
...
@@ -25,7 +25,7 @@ public function id() {
/**
* Add a new display handler to the view, automatically creating an id.
*
* @param $
type
* @param $
plugin_id
* The plugin type from the views plugin data. Defaults to 'page'.
* @param $title
* The title of the display; optional, may be filled in from default.
...
...
@@ -35,19 +35,23 @@ public function id() {
* The key to the display in $view->display, so that the new display
* can be easily located.
*/
function
add_display
(
$
type
=
'page'
,
$title
=
NULL
,
$id
=
NULL
)
{
if
(
empty
(
$
type
))
{
function
add_display
(
$
plugin_id
=
'page'
,
$title
=
NULL
,
$id
=
NULL
)
{
if
(
empty
(
$
plugin_id
))
{
return
FALSE
;
}
$plugin
=
views_fetch_plugin_data
(
'display'
,
$
type
);
$plugin
=
views_fetch_plugin_data
(
'display'
,
$
plugin_id
);
if
(
empty
(
$plugin
))
{
$plugin
[
'title'
]
=
t
(
'Broken'
);
}
if
(
empty
(
$id
))
{
$id
=
$this
->
generate_display_id
(
$type
);
$id
=
$this
->
generate_display_id
(
$plugin_id
);
// Generate a unique human readable name.
// Therefore find out how often the display_plugin already got used,
// which is stored at the end of the $id, for example page_1.
if
(
$id
!==
'default'
)
{
preg_match
(
"/[0-9]+/"
,
$id
,
$count
);
$count
=
$count
[
0
];
...
...
@@ -57,6 +61,8 @@ function add_display($type = 'page', $title = NULL, $id = NULL) {
}
if
(
empty
(
$title
))
{
// If we had more then one instance already attach the count,
// so you end up with "Page" and "Page 2" for example.
if
(
$count
>
1
)
{
$title
=
$plugin
[
'title'
]
.
' '
.
$count
;
}
...
...
@@ -67,7 +73,7 @@ function add_display($type = 'page', $title = NULL, $id = NULL) {
}
$display_options
=
array
(
'
type'
=>
$type
,
'
display_plugin'
=>
$plugin_id
,
'id'
=>
$id
,
'display_title'
=>
$title
,
);
...
...
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