Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupal
Commits
64002e87
Commit
64002e87
authored
Jul 31, 2012
by
Tim Plunkett
Browse files
Options
Downloads
Patches
Plain Diff
Bring _views_create_handler() and _views_create_plugin() closer together.
parent
3b2195d9
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!7452
Issue #1797438. HTML5 validation is preventing form submit and not fully...
,
!789
Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
includes/handlers.inc
+12
-23
12 additions, 23 deletions
includes/handlers.inc
views.module
+2
-2
2 additions, 2 deletions
views.module
with
14 additions
and
25 deletions
includes/handlers.inc
+
12
−
23
View file @
64002e87
...
...
@@ -13,50 +13,39 @@
/**
* Instantiate and construct a new plugin.
*
* @todo
* Figure out what to keep from _views_create_handler.
*/
function
_views_create_plugin
(
$type
,
$plugin_id
,
$definition
)
{
function
_views_create_plugin
(
$type
,
$definition
)
{
$manager
=
new
ViewsPluginManager
(
$type
);
$instance
=
$manager
->
createInstance
(
$plugin_id
);
$instance
=
$manager
->
createInstance
(
$definition
[
'plugin_id'
]);
$instance
->
is_plugin
=
TRUE
;
$instance
->
plugin_type
=
$type
;
$instance
->
plugin_name
=
$plugin_id
;
$instance
->
plugin_name
=
$
definition
[
'
plugin_id
'
]
;
$instance
->
set_definition
(
$definition
);
// Let the handler have something like a constructor.
$instance
->
construct
();
return
$instance
;
}
/**
* Instantiate and construct a new handler
*/
function
_views_create_handler
(
$definition
,
$type
=
'handler'
,
$handler_type
=
NULL
)
{
if
(
!
empty
(
$definition
[
'plugin_id'
]))
{
$manager
=
new
ViewsPluginManager
(
$handler_type
);
$handler
=
$manager
->
createInstance
(
$definition
[
'plugin_id'
]);
}
else
{
// @todo: remove this else, once all instances got converted.
$handler
=
new
$definition
[
'handler'
](
$definition
,
$definition
[
'handler'
]);
}
function
_views_create_handler
(
$type
,
$definition
)
{
$manager
=
new
ViewsPluginManager
(
$type
);
$instance
=
$manager
->
createInstance
(
$definition
[
'plugin_id'
]);
$handler
->
set_definition
(
$definition
);
$instance
->
is_handler
=
TRUE
;
$instance
->
handler_type
=
$type
;
$handler
->
is_handler
=
TRUE
;
$handler
->
handler_type
=
$handler_type
;
$instance
->
set_definition
(
$definition
);
// let the handler have something like a constructor.
$
handler
->
construct
();
$
instance
->
construct
();
return
$
handler
;
return
$
instance
;
}
/**
...
...
@@ -76,7 +65,7 @@ function _views_prepare_handler($definition, $data, $field, $type) {
}
}
return
_views_create_handler
(
$definition
,
'handler'
,
$type
);
return
_views_create_handler
(
$type
,
$definition
);
}
/**
...
...
This diff is collapsed.
Click to expand it.
views.module
+
2
−
2
View file @
64002e87
...
...
@@ -1290,7 +1290,7 @@ function views_get_handler($table, $field, $key, $override = NULL) {
'table'
=>
$table
,
'field'
=>
$field
,
);
return
_views_create_handler
(
$
bro
ke
n
,
'handler'
,
$
ke
y
);
return
_views_create_handler
(
$ke
y
,
$bro
ke
n
);
}
/**
...
...
@@ -1369,7 +1369,7 @@ function views_get_plugin($type, $plugin_id, $reset = FALSE) {
$manager
=
new
ViewsPluginManager
(
$type
);
$definition
=
$manager
->
getDefinition
(
$plugin_id
);
if
(
!
empty
(
$definition
))
{
return
_views_create_plugin
(
$type
,
$plugin_id
,
$definition
);
return
_views_create_plugin
(
$type
,
$definition
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment