Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
b158b24a
Commit
b158b24a
authored
Jul 28, 2012
by
Daniel Wehner
Committed by
Tim Plunkett
Oct 21, 2012
Browse files
fix several different kind of unrelated things
parent
49b44b5f
Changes
21
Hide whitespace changes
Inline
Side-by-side
includes/admin.inc
View file @
b158b24a
...
...
@@ -705,9 +705,9 @@ function views_ui_nojs_submit($form, &$form_state) {
*/
function
views_ui_wizard_form_validate
(
$form
,
&
$form_state
)
{
$wizard
=
views_ui_get_wizard
(
$form_state
[
'values'
][
'show'
][
'wizard_key'
]);
$manager
=
new
WizardManager
(
);
$manager
=
views_get_plugin_manager
(
'wizard'
);
$form_state
[
'wizard'
]
=
$wizard
;
$form_state
[
'wizard_instance'
]
=
$manager
->
createInstance
(
$wizard
[
'
name
'
]);
$form_state
[
'wizard_instance'
]
=
$manager
->
createInstance
(
$wizard
[
'
plugin_id
'
]);
$errors
=
$form_state
[
'wizard_instance'
]
->
validate
(
$form
,
$form_state
);
foreach
(
$errors
as
$name
=>
$message
)
{
form_set_error
(
$name
,
$message
);
...
...
includes/cache.inc
View file @
b158b24a
...
...
@@ -88,6 +88,17 @@ function _views_data_process_entity_types(&$data) {
*/
function
_views_fetch_plugin_data
(
$type
=
NULL
,
$plugin_id
=
NULL
,
$reset
=
FALSE
)
{
$manager
=
views_get_plugin_manager
(
$type
);
if
(
!
$type
&&
!
$plugin_id
)
{
$plugins
=
array
();
$plugin_types
=
array
(
'access'
,
'argument_default'
,
'argument_validator'
,
'cache'
,
'display_extender'
,
'display'
,
'exposed_form'
,
'localization'
,
'pager'
,
'query'
,
'row'
,
'style'
,
'wizard'
);
foreach
(
$plugin_types
as
$plugin_type
)
{
$manager
=
views_get_plugin_manager
(
$plugin_type
);
$plugins
[
$plugin_type
]
=
$manager
->
getDefinitions
();
}
return
$plugins
;
}
if
(
!
$plugin_id
)
{
return
$manager
->
getDefinitions
();
}
...
...
lib/Drupal/views/Plugins/Discovery/ViewsDiscovery.php
View file @
b158b24a
...
...
@@ -6,42 +6,46 @@
*/
namespace
Drupal\views\Plugins\Discovery
;
use
Drupal\Core\Plugin\Discovery\
Hook
Discovery
;
use
Drupal\Core\Plugin\Discovery\
AnnotatedClass
Discovery
;
/**
* Discovery interface which supports the hook_views_plugins mechanism.
*/
class
ViewsDiscovery
extends
HookDiscovery
{
/**
* The plugin type in views which should be discovered, for example query.
*
* @var string
*/
protected
$viewsPluginType
;
class
ViewsDiscovery
extends
AnnotatedClassDiscovery
{
public
function
getDefinitions
()
{
$definitions
=
parent
::
getDefinitions
();
foreach
(
$definitions
as
$definition
)
{
// @todo: Allow other modules to write views plugins
$module_dir
=
$module
=
'views'
;
// Setup automatic path/file finding for theme registration
if
(
$module_dir
==
'views'
)
{
$theme_path
=
drupal_get_path
(
'module'
,
$module_dir
)
.
'/theme'
;
$theme_file
=
'theme.inc'
;
$path
=
drupal_get_path
(
'module'
,
$module_dir
)
.
'/plugins'
;
}
else
{
$theme_path
=
$path
=
drupal_get_path
(
'module'
,
$module_dir
);
$theme_file
=
"
$module
.views.inc"
;
}
/**
* Constructs a Drupal\views\Plugin\Discovery\ViewsDiscovery object.
*
* @param string $hook
*
The Drupal hook that a module can implement in order to interface to
*
this discovery class.
* @param string $plugin_type
*
The plugin type in views which should be discovered, for example query.
*/
function
__construct
(
$hook
,
$plugin_type
)
{
$this
->
viewsPluginType
=
$plugin_type
;
parent
::
__construct
(
$hook
)
;
}
$definition
[
'module'
]
=
$module_dir
;
if
(
!
isset
(
$definition
[
'theme path'
]))
{
$definition
[
'theme path'
]
=
$theme_path
;
}
if
(
!
isset
(
$definition
[
'theme file'
]))
{
$definition
[
'theme file'
]
=
$theme_file
;
}
if
(
!
isset
(
$definition
[
'path'
]))
{
$definition
[
'path'
]
=
$path
;
}
if
(
!
isset
(
$definition
[
'parent'
]))
{
$definition
[
'parent'
]
=
'parent'
;
}
/**
* Implements Drupal\Component\Plugin\Discovery\DicoveryInterface::getDefinitions().
*/
public
function
getDefinitions
()
{
views_include
(
'plugins'
);
views_include_handlers
();
// merge the new data in
$definitions
[
$definition
[
'plugin_id'
]]
=
$definition
;
}
$definitions
=
module_invoke_all
(
$this
->
hook
);
drupal_alter
(
$this
->
hook
,
$definitions
);
return
$definitions
[
$this
->
viewsPluginType
];
return
$definitions
;
}
}
lib/Drupal/views/Plugins/Type/AccessPluginManager.php
View file @
b158b24a
...
...
@@ -10,11 +10,10 @@
use
Drupal\Component\Plugin\PluginManagerBase
;
use
Drupal\Component\Plugin\Factory\DefaultFactory
;
use
Drupal\views\Plugins\Discovery\ViewsDiscovery
;
use
Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery
;
class
AccessPluginManager
extends
PluginManagerBase
{
public
function
__construct
()
{
$this
->
discovery
=
new
AnnotatedClas
sDiscovery
(
'views'
,
'access'
);
$this
->
factory
=
new
DefaultFactory
(
$this
);
$this
->
discovery
=
new
View
sDiscovery
(
'views'
,
'access'
);
$this
->
factory
=
new
DefaultFactory
(
$this
->
discovery
);
}
}
lib/Drupal/views/Plugins/Type/ArgumentDefaultPluginManager.php
View file @
b158b24a
...
...
@@ -9,11 +9,12 @@
use
Drupal\Component\Plugin\PluginManagerBase
;
use
Drupal\Component\Plugin\Factory\DefaultFactory
;
use
Drupal\views\Plugins\Discovery\ViewsDiscovery
;
use
Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery
;
class
ArgumentDefaultPluginManager
extends
PluginManagerBase
{
public
function
__construct
()
{
$this
->
discovery
=
new
View
sDiscovery
(
'views
_plugins
'
,
'argument
default'
);
$this
->
factory
=
new
DefaultFactory
(
$this
);
$this
->
discovery
=
new
AnnotatedClas
sDiscovery
(
'views'
,
'argument
_
default'
);
$this
->
factory
=
new
DefaultFactory
(
$this
->
discovery
);
}
}
lib/Drupal/views/Plugins/Type/ArgumentValidatorPluginManager.php
View file @
b158b24a
...
...
@@ -15,6 +15,6 @@
class
ArgumentValidatorPluginManager
extends
PluginManagerBase
{
public
function
__construct
()
{
$this
->
discovery
=
new
AnnotatedClassDiscovery
(
'views'
,
'argument_validator'
);
$this
->
factory
=
new
DefaultFactory
(
$this
);
$this
->
factory
=
new
DefaultFactory
(
$this
->
discovery
);
}
}
lib/Drupal/views/Plugins/Type/CachePluginManager.php
View file @
b158b24a
...
...
@@ -15,6 +15,6 @@
class
CachePluginManager
extends
PluginManagerBase
{
public
function
__construct
()
{
$this
->
discovery
=
new
AnnotatedClassDiscovery
(
'views'
,
'cache'
);
$this
->
factory
=
new
DefaultFactory
(
$this
);
$this
->
factory
=
new
DefaultFactory
(
$this
->
discovery
);
}
}
lib/Drupal/views/Plugins/Type/DisplayExtenderPluginManager.php
View file @
b158b24a
...
...
@@ -9,11 +9,11 @@
use
Drupal\Component\Plugin\PluginManagerBase
;
use
Drupal\Component\Plugin\Factory\DefaultFactory
;
use
Drupal\
Core
\Plugin\Discovery\
AnnotatedClas
sDiscovery
;
use
Drupal\
Views
\Plugin
s
\Discovery\
View
sDiscovery
;
class
DisplayExtenderPluginManager
extends
PluginManagerBase
{
public
function
__construct
()
{
$this
->
discovery
=
new
AnnotatedClas
sDiscovery
(
'views'
,
'display_extender'
);
$this
->
factory
=
new
DefaultFactory
(
$this
);
$this
->
discovery
=
new
View
sDiscovery
(
'views'
,
'display_extender'
);
$this
->
factory
=
new
DefaultFactory
(
$this
->
discovery
);
}
}
lib/Drupal/views/Plugins/Type/DisplayPluginManager.php
View file @
b158b24a
...
...
@@ -9,12 +9,11 @@
use
Drupal\Component\Plugin\PluginManagerBase
;
use
Drupal\Component\Plugin\Factory\DefaultFactory
;
use
Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery
;
use
Drupal\views\Plugins\Discovery\ViewsDiscovery
;
class
DisplayPluginManager
extends
PluginManagerBase
{
public
function
__construct
()
{
$this
->
discovery
=
new
AnnotatedClas
sDiscovery
(
'views'
,
'display'
);
$this
->
factory
=
new
DefaultFactory
(
$this
);
$this
->
discovery
=
new
View
sDiscovery
(
'views'
,
'display'
);
$this
->
factory
=
new
DefaultFactory
(
$this
->
discovery
);
}
}
lib/Drupal/views/Plugins/Type/ExposedFormPluginManager.php
View file @
b158b24a
...
...
@@ -9,12 +9,11 @@
use
Drupal\Component\Plugin\PluginManagerBase
;
use
Drupal\Component\Plugin\Factory\DefaultFactory
;
use
Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery
;
use
Drupal\Views\Plugins\Discovery\ViewsDiscovery
;
class
ExposedFormPluginManager
extends
PluginManagerBase
{
public
function
__construct
()
{
$this
->
discovery
=
new
AnnotatedClas
sDiscovery
(
'views'
,
'exposed_form'
);
$this
->
discovery
=
new
View
sDiscovery
(
'views'
,
'exposed_form'
);
$this
->
factory
=
new
DefaultFactory
(
$this
);
}
}
lib/Drupal/views/Plugins/Type/HandlerPluginManager.php
View file @
b158b24a
...
...
@@ -9,7 +9,7 @@
use
Drupal\Component\Plugin\PluginManagerBase
;
use
Drupal\Component\Plugin\Factory\DefaultFactory
;
use
Drupal\
Core
\Plugin\Discovery\
AnnotatedClas
sDiscovery
;
use
Drupal\
Views
\Plugin
s
\Discovery\
View
sDiscovery
;
class
HandlerPluginManager
extends
PluginManagerBase
{
/**
...
...
@@ -22,9 +22,7 @@ class HandlerPluginManager extends PluginManagerBase {
public
function
__construct
(
$type
)
{
$this
->
type
=
$type
;
if
(
in_array
(
$this
->
type
,
array
(
'sort'
,
'filter'
,
'relationship'
,
'field'
,
'area'
,
'argument'
)))
{
$this
->
discovery
=
new
AnnotatedClassDiscovery
(
'views'
,
$this
->
type
);
}
$this
->
discovery
=
new
ViewsDiscovery
(
'views'
,
$this
->
type
);
$this
->
factory
=
new
DefaultFactory
(
$this
->
discovery
);
}
}
lib/Drupal/views/Plugins/Type/LocalizationPluginManager.php
View file @
b158b24a
...
...
@@ -9,12 +9,11 @@
use
Drupal\Component\Plugin\PluginManagerBase
;
use
Drupal\Component\Plugin\Factory\DefaultFactory
;
use
Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery
;
use
Drupal\Views\Plugins\Discovery\ViewsDiscovery
;
class
LocalizationPluginManager
extends
PluginManagerBase
{
public
function
__construct
()
{
$this
->
discovery
=
new
AnnotatedClas
sDiscovery
(
'views'
,
'localization'
);
$this
->
discovery
=
new
View
sDiscovery
(
'views'
,
'localization'
);
$this
->
factory
=
new
DefaultFactory
(
$this
);
}
}
lib/Drupal/views/Plugins/Type/PagerPluginManager.php
View file @
b158b24a
...
...
@@ -9,12 +9,11 @@
use
Drupal\Component\Plugin\PluginManagerBase
;
use
Drupal\Component\Plugin\Factory\DefaultFactory
;
use
Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery
;
use
Drupal\Views\Plugins\Discovery\ViewsDiscovery
;
class
PagerPluginManager
extends
PluginManagerBase
{
public
function
__construct
()
{
$this
->
discovery
=
new
AnnotatedClas
sDiscovery
(
'views'
,
'pager'
);
$this
->
discovery
=
new
View
sDiscovery
(
'views'
,
'pager'
);
$this
->
factory
=
new
DefaultFactory
(
$this
);
}
}
lib/Drupal/views/Plugins/Type/QueryPluginManager.php
View file @
b158b24a
...
...
@@ -9,11 +9,11 @@
use
Drupal\Component\Plugin\PluginManagerBase
;
use
Drupal\Component\Plugin\Factory\DefaultFactory
;
use
Drupal\
Core
\Plugin\Discovery\
AnnotatedClas
sDiscovery
;
use
Drupal\
Views
\Plugin
s
\Discovery\
View
sDiscovery
;
class
QueryPluginManager
extends
PluginManagerBase
{
public
function
__construct
()
{
$this
->
discovery
=
new
AnnotatedClas
sDiscovery
(
'views'
,
'query'
);
$this
->
discovery
=
new
View
sDiscovery
(
'views'
,
'query'
);
$this
->
factory
=
new
DefaultFactory
(
$this
);
}
}
lib/Drupal/views/Plugins/Type/RowPluginManager.php
View file @
b158b24a
...
...
@@ -9,11 +9,11 @@
use
Drupal\Component\Plugin\PluginManagerBase
;
use
Drupal\Component\Plugin\Factory\DefaultFactory
;
use
Drupal\
Core
\Plugin\Discovery\
AnnotatedClas
sDiscovery
;
use
Drupal\
Views
\Plugin
s
\Discovery\
View
sDiscovery
;
class
RowPluginManager
extends
PluginManagerBase
{
public
function
__construct
()
{
$this
->
discovery
=
new
AnnotatedClas
sDiscovery
(
'views'
,
'row'
);
$this
->
discovery
=
new
View
sDiscovery
(
'views'
,
'row'
);
$this
->
factory
=
new
DefaultFactory
(
$this
);
}
}
lib/Drupal/views/Plugins/Type/StylePluginManager.php
View file @
b158b24a
...
...
@@ -9,11 +9,12 @@
use
Drupal\Component\Plugin\PluginManagerBase
;
use
Drupal\Component\Plugin\Factory\DefaultFactory
;
use
Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery
;
use
Drupal\Views\Plugins\Discovery\ViewsDiscovery
;
class
StylePluginManager
extends
PluginManagerBase
{
public
function
__construct
()
{
$this
->
discovery
=
new
AnnotatedClas
sDiscovery
(
'views'
,
'style'
);
$this
->
discovery
=
new
View
sDiscovery
(
'views'
,
'style'
);
$this
->
factory
=
new
DefaultFactory
(
$this
);
}
}
lib/Drupal/views/Plugins/Type/WizardPluginManager.php
View file @
b158b24a
...
...
@@ -9,11 +9,11 @@
use
Drupal\Component\Plugin\PluginManagerBase
;
use
Drupal\Component\Plugin\Factory\DefaultFactory
;
use
Drupal\
Core
\Plugin\Discovery\
AnnotatedClas
sDiscovery
;
use
Drupal\
Views
\Plugin
s
\Discovery\
View
sDiscovery
;
class
WizardPluginManager
extends
PluginManagerBase
{
public
function
__construct
()
{
$this
->
discovery
=
new
AnnotatedClas
sDiscovery
(
'views'
,
'wizard'
);
$this
->
discovery
=
new
View
sDiscovery
(
'views'
,
'wizard'
);
$this
->
factory
=
new
DefaultFactory
(
$this
->
discovery
);
}
}
...
...
lib/Drupal/views/Plugins/views/display/DefaultDisplay.php
View file @
b158b24a
...
...
@@ -18,7 +18,7 @@
/**
* @Plugin(
* plugin_id = "
standard
",
* plugin_id = "
default
",
* title = @Translation("Master"),
* help = @Translation("Default settings for this view."),
* theme = "views_view",
...
...
lib/Drupal/views/Plugins/views/display/DisplayPluginBase.php
View file @
b158b24a
...
...
@@ -83,6 +83,7 @@ function init(&$view, &$display, $options = NULL) {
unset
(
$options
[
'defaults'
]);
}
views_include
(
'cache'
);
// Cache for unpack_options, but not if we are in the ui.
static
$unpack_options
=
array
();
if
(
empty
(
$view
->
editing
))
{
...
...
@@ -1212,7 +1213,8 @@ function options_summary(&$categories, &$options) {
}
if
(
!
empty
(
$style_plugin
[
'uses_row_plugin'
]))
{
$row_plugin
=
views_fetch_plugin_data
(
'row'
,
$this
->
get_option
(
'row_plugin'
));
$manager
=
views_get_plugin_manager
(
'row'
);
$row_plugin
=
$manager
->
getDefinition
(
$this
->
get_option
(
'row_plugin'
));
$row_plugin_instance
=
$this
->
get_plugin
(
'row'
);
$row_summary
=
empty
(
$row_plugin
[
'title'
])
?
t
(
'Missing style plugin'
)
:
$row_plugin_instance
->
summary_title
();
$row_title
=
empty
(
$row_plugin
[
'title'
])
?
t
(
'Missing style plugin'
)
:
$row_plugin_instance
->
plugin_title
();
...
...
views.module
View file @
b158b24a
...
...
@@ -884,12 +884,17 @@ function views_add_contextual_links(&$render_element, $location, $view, $display
// If contextual_links_locations are not set, provide a sane default. (To
// avoid displaying any contextual links at all, a display plugin can still
// set 'contextual_links_locations' to, e.g., {""}.)
if
(
!
(
isset
(
$plugin
[
'contextual_links_locations'
])
&&
$plugin
[
'contextual_links_locations'
]
=
array
(
""
)))
{
$plugin
+=
array
(
'contextual_links_locations'
=>
array
(
'view'
));
if
(
!
isset
(
$plugin
[
'contextual_links_locations'
]))
{
$plugin
[
'contextual_links_locations'
]
=
array
(
'view'
);
}
else
{
else
if
(
$plugin
[
'contextual_links_locations'
]
=
array
()
||
$plugin
[
'contextual_links_locations'
]
==
array
(
''
))
{
$plugin
[
'contextual_links_locations'
]
=
array
();
}
else
{
$plugin
+=
array
(
'contextual_links_locations'
=>
array
(
'view'
));
}
// On exposed_forms blocks contextual links should always be visible.
$plugin
[
'contextual_links_locations'
][]
=
'special_block_-exp'
;
$has_links
=
!
empty
(
$plugin
[
'contextual links'
])
&&
!
empty
(
$plugin
[
'contextual_links_locations'
]);
...
...
@@ -1345,9 +1350,6 @@ function views_fetch_plugin_names($type, $key = NULL, $base = array()) {
foreach
(
$definitions
as
$plugin_id
=>
$plugin
)
{
if
(
empty
(
$plugin
[
'no ui'
])
&&
(
empty
(
$base
)
||
empty
(
$plugin
[
'base'
])
||
array_intersect
(
$base
,
$plugin
[
'base'
])))
{
$plugins
[
$plugin_id
]
=
$plugin
[
'title'
];
if
(
!
isset
(
$plugin
[
'title'
]))
{
dsm
(
$plugin
);
}
}
}
...
...
@@ -1355,6 +1357,7 @@ function views_fetch_plugin_names($type, $key = NULL, $base = array()) {
asort
(
$plugins
);
return
$plugins
;
}
// fall-through
return
array
();
}
...
...
@@ -1400,10 +1403,10 @@ function views_get_plugin_manager($type) {
case
'row'
:
$manager
=
new
RowPluginManager
();
break
;
case
'argument
default'
:
case
'argument
_
default'
:
$manager
=
new
ArgumentDefaultPluginManager
();
break
;
case
'argument
validator'
:
case
'argument
_
validator'
:
$manager
=
new
ArgumentValidatorPluginManager
();
break
;
case
'access'
:
...
...
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment