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
229
Merge Requests
229
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
206cd481
Commit
206cd481
authored
Sep 08, 2012
by
dawehner
Committed by
tim.plunkett
Oct 21, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#1778148
by dawehner: Added Rename view::viewsObjectTypes to view::viewsHandlerTypes.
parent
b88ea073
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
69 additions
and
38 deletions
+69
-38
includes/admin.inc
includes/admin.inc
+17
-17
lib/Drupal/views/Plugin/views/HandlerBase.php
lib/Drupal/views/Plugin/views/HandlerBase.php
+2
-2
lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php
lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php
+5
-5
lib/Drupal/views/Tests/ViewTest.php
lib/Drupal/views/Tests/ViewTest.php
+21
-0
lib/Drupal/views/View.php
lib/Drupal/views/View.php
+19
-9
lib/Drupal/views/ViewStorage.php
lib/Drupal/views/ViewStorage.php
+4
-4
views_ui.module
views_ui.module
+1
-1
No files found.
includes/admin.inc
View file @
206cd481
...
...
@@ -2021,7 +2021,7 @@ function views_ui_import_validate($form, &$form_state) {
}
}
foreach
(
View
::
views
Object
Types
()
as
$type
=>
$info
)
{
foreach
(
View
::
views
Handler
Types
()
as
$type
=>
$info
)
{
$handlers
=
$display
->
handler
->
getHandlers
(
$type
);
if
(
$handlers
)
{
foreach
(
$handlers
as
$id
=>
$handler
)
{
...
...
@@ -2149,7 +2149,7 @@ function views_ui_edit_form_get_bucket($type, $view, $display) {
$build
=
array
(
'#theme_wrappers'
=>
array
(
'views_ui_display_tab_bucket'
),
);
$types
=
View
::
views
Object
Types
();
$types
=
View
::
views
Handler
Types
();
$build
[
'#overridden'
]
=
FALSE
;
$build
[
'#defaulted'
]
=
FALSE
;
...
...
@@ -3272,7 +3272,7 @@ function views_ui_config_type_form($form, &$form_state) {
$display_id
=
$form_state
[
'display_id'
];
$type
=
$form_state
[
'type'
];
$types
=
View
::
views
Object
Types
();
$types
=
View
::
views
Handler
Types
();
if
(
!
$view
->
setDisplay
(
$display_id
))
{
views_ajax_error
(
t
(
'Invalid display id @display'
,
array
(
'@display'
=>
$display_id
)));
}
...
...
@@ -3304,7 +3304,7 @@ function views_ui_config_type_form($form, &$form_state) {
* Submit handler for type configuration form
*/
function
views_ui_config_type_form_submit
(
$form
,
&
$form_state
)
{
$types
=
View
::
views
Object
Types
();
$types
=
View
::
views
Handler
Types
();
$display
=
&
$form_state
[
'view'
]
->
display
[
$form_state
[
'display_id'
]];
// Store in cache
...
...
@@ -3319,7 +3319,7 @@ function views_ui_rearrange_form($form, &$form_state) {
$display_id
=
$form_state
[
'display_id'
];
$type
=
$form_state
[
'type'
];
$types
=
View
::
views
Object
Types
();
$types
=
View
::
views
Handler
Types
();
if
(
!
$view
->
setDisplay
(
$display_id
))
{
views_ajax_error
(
t
(
'Invalid display id @display'
,
array
(
'@display'
=>
$display_id
)));
}
...
...
@@ -3551,7 +3551,7 @@ function theme_views_ui_build_group_filter_form($variables) {
* Submit handler for rearranging form.
*/
function
views_ui_rearrange_form_submit
(
$form
,
&
$form_state
)
{
$types
=
View
::
views
Object
Types
();
$types
=
View
::
views
Handler
Types
();
$display
=
&
$form_state
[
'view'
]
->
display
[
$form_state
[
'display_id'
]];
$old_fields
=
$display
->
handler
->
getOption
(
$types
[
$form_state
[
'type'
]][
'plural'
]);
...
...
@@ -3587,7 +3587,7 @@ function views_ui_rearrange_filter_form($form, &$form_state) {
$display_id
=
$form_state
[
'display_id'
];
$type
=
$form_state
[
'type'
];
$types
=
View
::
views
Object
Types
();
$types
=
View
::
views
Handler
Types
();
if
(
!
$view
->
setDisplay
(
$display_id
))
{
views_ajax_render
(
t
(
'Invalid display id @display'
,
array
(
'@display'
=>
$display_id
)));
}
...
...
@@ -3853,7 +3853,7 @@ function theme_views_ui_rearrange_filter_form(&$vars) {
* Submit handler for rearranging form
*/
function
views_ui_rearrange_filter_form_submit
(
$form
,
&
$form_state
)
{
$types
=
View
::
views
Object
Types
();
$types
=
View
::
views
Handler
Types
();
$display
=
&
$form_state
[
'view'
]
->
display
[
$form_state
[
'display_id'
]];
$remember_groups
=
array
();
...
...
@@ -3976,7 +3976,7 @@ function views_ui_add_item_form($form, &$form_state) {
}
$display
=
&
$view
->
display
[
$display_id
];
$types
=
View
::
views
Object
Types
();
$types
=
View
::
views
Handler
Types
();
$ltitle
=
$types
[
$type
][
'ltitle'
];
$section
=
$types
[
$type
][
'plural'
];
...
...
@@ -4092,7 +4092,7 @@ function views_ui_add_item_form($form, &$form_state) {
*/
function
views_ui_add_item_form_submit
(
$form
,
&
$form_state
)
{
$type
=
$form_state
[
'type'
];
$types
=
View
::
views
Object
Types
();
$types
=
View
::
views
Handler
Types
();
$section
=
$types
[
$type
][
'plural'
];
// Handle the override select.
...
...
@@ -4219,7 +4219,7 @@ function views_ui_config_item_form($form, &$form_state) {
$form
[
'markup'
]
=
array
(
'#markup'
=>
t
(
"Error: handler for @table > @field doesn't exist!"
,
array
(
'@table'
=>
$item
[
'table'
],
'@field'
=>
$item
[
'field'
])));
}
else
{
$types
=
View
::
views
Object
Types
();
$types
=
View
::
views
Handler
Types
();
// If this item can come from the default display, show a dropdown
// that lets the user choose which display the changes should apply to.
...
...
@@ -4339,7 +4339,7 @@ function views_ui_config_item_form_submit_temporary($form, &$form_state) {
// Run it through the handler's submit function.
$form_state
[
'handler'
]
->
submitOptionsForm
(
$form
[
'options'
],
$form_state
);
$item
=
$form_state
[
'handler'
]
->
options
;
$types
=
View
::
views
Object
Types
();
$types
=
View
::
views
Handler
Types
();
// For footer/header $handler_type is area but $type is footer/header.
// For all other handle types it's the same.
...
...
@@ -4393,7 +4393,7 @@ function views_ui_config_item_form_submit($form, &$form_state) {
// Run it through the handler's submit function.
$form_state
[
'handler'
]
->
submitOptionsForm
(
$form
[
'options'
],
$form_state
);
$item
=
$form_state
[
'handler'
]
->
options
;
$types
=
View
::
views
Object
Types
();
$types
=
View
::
views
Handler
Types
();
// For footer/header $handler_type is area but $type is footer/header.
// For all other handle types it's the same.
...
...
@@ -4469,7 +4469,7 @@ function views_ui_config_item_group_form($type, &$form_state) {
}
else
{
$handler
->
init
(
$view
,
$item
);
$types
=
View
::
views
Object
Types
();
$types
=
View
::
views
Handler
Types
();
$form
[
'#title'
]
=
t
(
'Configure group settings for @type %item'
,
array
(
'@type'
=>
$types
[
$type
][
'lstitle'
],
'%item'
=>
$handler
->
adminLabel
()));
...
...
@@ -4570,7 +4570,7 @@ function views_ui_config_item_extra_form($form, &$form_state) {
}
else
{
$handler
->
init
(
$view
,
$item
);
$types
=
View
::
views
Object
Types
();
$types
=
View
::
views
Handler
Types
();
$form
[
'#title'
]
=
t
(
'Configure extra settings for @type %item'
,
array
(
'@type'
=>
$types
[
$type
][
'lstitle'
],
'%item'
=>
$handler
->
adminLabel
()));
...
...
@@ -4641,7 +4641,7 @@ function views_ui_config_style_form($form, &$form_state) {
}
else
{
$handler
->
init
(
$view
,
$item
);
$types
=
View
::
views
Object
Types
();
$types
=
View
::
views
Handler
Types
();
$form
[
'#title'
]
=
t
(
'Configure summary style for @type %item'
,
array
(
'@type'
=>
$types
[
$type
][
'lstitle'
],
'%item'
=>
$handler
->
adminLabel
()));
...
...
@@ -5367,7 +5367,7 @@ function views_ui_field_list() {
foreach
(
$views
as
$view
)
{
foreach
(
$view
->
display
as
$display_id
=>
$display
)
{
if
(
$view
->
setDisplay
(
$display_id
))
{
foreach
(
View
::
views
Object
Types
()
as
$type
=>
$info
)
{
foreach
(
View
::
views
Handler
Types
()
as
$type
=>
$info
)
{
foreach
(
$view
->
getItems
(
$type
,
$display_id
)
as
$item
)
{
$data
=
views_fetch_data
(
$item
[
'table'
]);
if
(
isset
(
$data
[
$item
[
'field'
]])
&&
isset
(
$data
[
$item
[
'field'
]][
$type
])
...
...
lib/Drupal/views/Plugin/views/HandlerBase.php
View file @
206cd481
...
...
@@ -104,7 +104,7 @@ public function init(&$view, &$options) {
$options
[
'field'
]
=
$this
->
actual_field
;
}
$types
=
View
::
views
Object
Types
();
$types
=
View
::
views
Handler
Types
();
$plural
=
$this
->
plugin_type
;
if
(
isset
(
$types
[
$this
->
plugin_type
][
'plural'
]))
{
$plural
=
$types
[
$this
->
plugin_type
][
'plural'
];
...
...
@@ -324,7 +324,7 @@ public function usesGroupBy() {
public
function
buildGroupByForm
(
&
$form
,
&
$form_state
)
{
$view
=
&
$form_state
[
'view'
];
$display_id
=
$form_state
[
'display_id'
];
$types
=
View
::
views
Object
Types
();
$types
=
View
::
views
Handler
Types
();
$type
=
$form_state
[
'type'
];
$id
=
$form_state
[
'id'
];
...
...
lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php
View file @
206cd481
...
...
@@ -866,7 +866,7 @@ public function &getHandler($type, $id) {
public
function
getHandlers
(
$type
)
{
if
(
!
isset
(
$this
->
handlers
[
$type
]))
{
$this
->
handlers
[
$type
]
=
array
();
$types
=
View
::
views
Object
Types
();
$types
=
View
::
views
Handler
Types
();
$plural
=
$types
[
$type
][
'plural'
];
foreach
(
$this
->
getOption
(
$plural
)
as
$id
=>
$info
)
{
...
...
@@ -2665,7 +2665,7 @@ public function validate() {
}
// Validate handlers
foreach
(
View
::
views
Object
Types
()
as
$type
=>
$info
)
{
foreach
(
View
::
views
Handler
Types
()
as
$type
=>
$info
)
{
foreach
(
$this
->
getHandlers
(
$type
)
as
$handler
)
{
$result
=
$handler
->
validate
();
if
(
!
empty
(
$result
)
&&
is_array
(
$result
))
{
...
...
@@ -2690,7 +2690,7 @@ public function validate() {
*
*/
public
function
isIdentifierUnique
(
$id
,
$identifier
)
{
foreach
(
View
::
views
Object
Types
()
as
$type
=>
$info
)
{
foreach
(
View
::
views
Handler
Types
()
as
$type
=>
$info
)
{
foreach
(
$this
->
getHandlers
(
$type
)
as
$key
=>
$handler
)
{
if
(
$handler
->
canExpose
()
&&
$handler
->
isExposed
())
{
if
(
$handler
->
isAGroup
())
{
...
...
@@ -2794,7 +2794,7 @@ public function exportHandler($indent, $prefix, $storage, $option, $definition,
else
{
$type
=
$option
;
}
$types
=
View
::
views
Object
Types
();
$types
=
View
::
views
Handler
Types
();
foreach
(
$storage
[
$option
]
as
$id
=>
$info
)
{
if
(
!
empty
(
$types
[
$type
][
'type'
]))
{
$handler_type
=
$types
[
$type
][
'type'
];
...
...
@@ -2952,7 +2952,7 @@ public function unpackHandler(&$translatable, $storage, $option, $definition, $p
else
{
$type
=
$option
;
}
$types
=
View
::
views
Object
Types
();
$types
=
View
::
views
Handler
Types
();
foreach
(
$storage
[
$option
]
as
$id
=>
$info
)
{
if
(
!
empty
(
$types
[
$type
][
'type'
]))
{
$handler_type
=
$types
[
$type
][
'type'
];
...
...
lib/Drupal/views/Tests/ViewTest.php
View file @
206cd481
...
...
@@ -7,6 +7,8 @@
namespace
Drupal\views\Tests
;
use
Drupal\views\View
;
/**
* Views class tests.
*/
...
...
@@ -68,6 +70,25 @@ function assertViewDestroy($view) {
$this
->
assertEqual
(
$view
->
attachment_after
,
''
);
}
/**
* Tests view::viewsHandlerTypes().
*/
public
function
testViewshandlerTypes
()
{
$types
=
View
::
viewsHandlerTypes
();
foreach
(
array
(
'field'
,
'filter'
,
'argument'
,
'sort'
,
'header'
,
'footer'
,
'empty'
)
as
$type
)
{
$this
->
assertTrue
(
isset
(
$types
[
$type
]));
// @todo The key on the display should be footers, headers and empties
// or something similar instead of the singular, but so long check for
// this special case.
if
(
isset
(
$types
[
$type
][
'type'
])
&&
$types
[
$type
][
'type'
]
==
'area'
)
{
$this
->
assertEqual
(
$types
[
$type
][
'plural'
],
$type
);
}
else
{
$this
->
assertEqual
(
$types
[
$type
][
'plural'
],
$type
.
's'
);
}
}
}
function
testValidate
()
{
// Test a view with multiple displays.
// Validating a view shouldn't change the active display.
...
...
lib/Drupal/views/View.php
View file @
206cd481
...
...
@@ -742,7 +742,7 @@ public function fixMissingRelationships() {
$base_tables
=
array_keys
(
$base_tables
);
$missing_base_tables
=
array
();
$types
=
View
::
views
Object
Types
();
$types
=
View
::
views
Handler
Types
();
foreach
(
$types
as
$key
=>
$info
)
{
foreach
(
$this
->
display_handler
->
getOption
(
$info
[
'plural'
])
as
$id
=>
$options
)
{
$options
[
'table'
]
=
views_move_table
(
$options
[
'table'
]);
...
...
@@ -801,7 +801,7 @@ public function fixMissingRelationships() {
public
function
initHandlers
()
{
if
(
empty
(
$this
->
inited
))
{
$this
->
fixMissingRelationships
();
foreach
(
View
::
views
Object
Types
()
as
$key
=>
$info
)
{
foreach
(
View
::
views
Handler
Types
()
as
$key
=>
$info
)
{
$this
->
_initHandler
(
$key
,
$info
);
}
$this
->
inited
=
TRUE
;
...
...
@@ -865,7 +865,7 @@ public function getBaseTables() {
* Run the preQuery() on all active handlers.
*/
protected
function
_preQuery
()
{
foreach
(
View
::
views
Object
Types
()
as
$key
=>
$info
)
{
foreach
(
View
::
views
Handler
Types
()
as
$key
=>
$info
)
{
$handlers
=
&
$this
->
$key
;
$position
=
0
;
foreach
(
$handlers
as
$id
=>
$handler
)
{
...
...
@@ -880,7 +880,7 @@ protected function _preQuery() {
* Run the postExecute() on all active handlers.
*/
protected
function
_postExecute
()
{
foreach
(
View
::
views
Object
Types
()
as
$key
=>
$info
)
{
foreach
(
View
::
views
Handler
Types
()
as
$key
=>
$info
)
{
$handlers
=
&
$this
->
$key
;
foreach
(
$handlers
as
$id
=>
$handler
)
{
$handlers
[
$id
]
->
postExecute
(
$this
->
result
);
...
...
@@ -894,7 +894,7 @@ protected function _postExecute() {
* @param $key
* One of 'argument', 'field', 'sort', 'filter', 'relationship'
* @param $info
* The $info from views
Object
Types for this object.
* The $info from views
Handler
Types for this object.
*/
protected
function
_initHandler
(
$key
,
$info
)
{
// Load the requested items from the display onto the object.
...
...
@@ -1973,7 +1973,7 @@ public function destroy() {
}
}
foreach
(
View
::
views
Object
Types
()
as
$type
=>
$info
)
{
foreach
(
View
::
views
Handler
Types
()
as
$type
=>
$info
)
{
if
(
isset
(
$this
->
$type
))
{
$handlers
=
&
$this
->
$type
;
foreach
(
$handlers
as
$id
=>
$item
)
{
...
...
@@ -2124,10 +2124,20 @@ public function processLocaleStrings($op) {
}
/**
* Provide
a a list of views object
types used in a view, with some information
* Provide
a list of views handler
types used in a view, with some information
* about them.
*/
public
static
function
viewsObjectTypes
()
{
*
* @return array
* An array of associative arrays containing:
* - title: The title of the handler type.
* - ltitle: The lowercase title of the handler type.
* - stitle: A singular title of the handler type.
* - lstitle: A singular lowercase title of the handler type.
* - plural: Plural version of the handler type.
* - (optional) type: The actual internal used handler type. This key is
* just used for header,footer,empty to link to the internal type: area.
*/
public
static
function
viewsHandlerTypes
()
{
static
$retval
=
NULL
;
// Statically cache this so t() doesn't run a bajillion times.
...
...
lib/Drupal/views/ViewStorage.php
View file @
206cd481
...
...
@@ -217,7 +217,7 @@ public function &newDisplay($plugin_id = 'page', $title = NULL, $id = NULL) {
* The unique ID for this handler instance.
*/
public
function
addItem
(
$display_id
,
$type
,
$table
,
$field
,
$options
=
array
(),
$id
=
NULL
)
{
$types
=
View
::
views
Object
Types
();
$types
=
View
::
views
Handler
Types
();
$this
->
setDisplay
(
$display_id
);
$fields
=
$this
->
display
[
$display_id
]
->
handler
->
getOption
(
$types
[
$type
][
'plural'
]);
...
...
@@ -263,7 +263,7 @@ public function getItems($type, $display_id = NULL) {
}
// Get info about the types so we can get the right data.
$types
=
View
::
views
Object
Types
();
$types
=
View
::
views
Handler
Types
();
return
$this
->
display
[
$display_id
]
->
handler
->
getOption
(
$types
[
$type
][
'plural'
]);
}
...
...
@@ -283,7 +283,7 @@ public function getItems($type, $display_id = NULL) {
*/
public
function
getItem
(
$display_id
,
$type
,
$id
)
{
// Get info about the types so we can get the right data.
$types
=
View
::
views
Object
Types
();
$types
=
View
::
views
Handler
Types
();
// Initialize the display
$this
->
setDisplay
(
$display_id
);
...
...
@@ -309,7 +309,7 @@ public function getItem($display_id, $type, $id) {
*/
public
function
setItem
(
$display_id
,
$type
,
$id
,
$item
)
{
// Get info about the types so we can get the right data.
$types
=
View
::
views
Object
Types
();
$types
=
View
::
views
Handler
Types
();
// Initialize the display.
$this
->
setDisplay
(
$display_id
);
...
...
views_ui.module
View file @
206cd481
...
...
@@ -476,7 +476,7 @@ function views_ui_view_preview_section_handler_links($view, $type, $title = FALS
$handlers
=
$view
->
display_handler
->
getHandlers
(
$type
);
$links
=
array
();
$types
=
View
::
views
Object
Types
();
$types
=
View
::
views
Handler
Types
();
if
(
$title
)
{
$links
[
$type
.
'-title'
]
=
array
(
'title'
=>
$types
[
$type
][
'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