Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
af74bd08
Commit
af74bd08
authored
Aug 13, 2012
by
dawehner
Committed by
tim.plunkett
Oct 21, 2012
Browse files
Update Argument system to use the new type names for default/validator plugins
parent
1dde116d
Changes
1
Hide whitespace changes
Inline
Side-by-side
lib/Drupal/views/Plugin/views/argument/ArgumentPluginBase.php
View file @
af74bd08
...
...
@@ -368,7 +368,7 @@ function options_form(&$form, &$form_state) {
);
$validate_types
=
array
(
'none'
=>
t
(
'- Basic validation -'
));
$plugins
=
views_fetch_plugin_data
(
'argument
validator'
);
$plugins
=
views_fetch_plugin_data
(
'argument
_
validator'
);
foreach
(
$plugins
as
$id
=>
$info
)
{
if
(
!
empty
(
$info
[
'no_ui'
]))
{
continue
;
...
...
@@ -390,7 +390,7 @@ function options_form(&$form, &$form_state) {
// If we decide this validator is ok, add it to the list.
if
(
$valid
)
{
$plugin
=
$this
->
get_plugin
(
'argument
validator'
,
$id
);
$plugin
=
$this
->
get_plugin
(
'argument
_
validator'
,
$id
);
if
(
$plugin
)
{
if
(
$plugin
->
access
()
||
$this
->
options
[
'validate'
][
'type'
]
==
$id
)
{
$form
[
'validate'
][
'options'
][
$id
]
=
array
(
...
...
@@ -438,7 +438,7 @@ function options_validate(&$form, &$form_state) {
// Let the plugins do validation.
$default_id
=
$form_state
[
'values'
][
'options'
][
'default_argument_type'
];
$plugin
=
$this
->
get_plugin
(
'argument
default'
,
$default_id
);
$plugin
=
$this
->
get_plugin
(
'argument
_
default'
,
$default_id
);
if
(
$plugin
)
{
$plugin
->
options_validate
(
$form
[
'argument_default'
][
$default_id
],
$form_state
,
$form_state
[
'values'
][
'options'
][
'argument_default'
][
$default_id
]);
}
...
...
@@ -451,7 +451,7 @@ function options_validate(&$form, &$form_state) {
}
$validate_id
=
$form_state
[
'values'
][
'options'
][
'validate'
][
'type'
];
$plugin
=
$this
->
get_plugin
(
'argument
validator'
,
$validate_id
);
$plugin
=
$this
->
get_plugin
(
'argument
_
validator'
,
$validate_id
);
if
(
$plugin
)
{
$plugin
->
options_validate
(
$form
[
'validate'
][
'options'
][
$default_id
],
$form_state
,
$form_state
[
'values'
][
'options'
][
'validate'
][
'options'
][
$validate_id
]);
}
...
...
@@ -465,7 +465,7 @@ function options_submit(&$form, &$form_state) {
// Let the plugins make submit modifications if necessary.
$default_id
=
$form_state
[
'values'
][
'options'
][
'default_argument_type'
];
$plugin
=
$this
->
get_plugin
(
'argument
default'
,
$default_id
);
$plugin
=
$this
->
get_plugin
(
'argument
_
default'
,
$default_id
);
if
(
$plugin
)
{
$options
=
&
$form_state
[
'values'
][
'options'
][
'argument_default'
][
$default_id
];
$plugin
->
options_submit
(
$form
[
'argument_default'
][
$default_id
],
$form_state
,
$options
);
...
...
@@ -484,7 +484,7 @@ function options_submit(&$form, &$form_state) {
}
$validate_id
=
$form_state
[
'values'
][
'options'
][
'validate'
][
'type'
];
$plugin
=
$this
->
get_plugin
(
'argument
validator'
,
$validate_id
);
$plugin
=
$this
->
get_plugin
(
'argument
_
validator'
,
$validate_id
);
if
(
$plugin
)
{
$options
=
&
$form_state
[
'values'
][
'options'
][
'validate'
][
'options'
][
$validate_id
];
$plugin
->
options_submit
(
$form
[
'validate'
][
'options'
][
$validate_id
],
$form_state
,
$options
);
...
...
@@ -563,7 +563,7 @@ function default_actions($which = NULL) {
* default action is set to provide default argument.
*/
function
default_argument_form
(
&
$form
,
&
$form_state
)
{
$plugins
=
views_fetch_plugin_data
(
'argument
default'
);
$plugins
=
views_fetch_plugin_data
(
'argument
_
default'
);
$options
=
array
();
$form
[
'default_argument_skip_url'
]
=
array
(
...
...
@@ -594,7 +594,7 @@ function default_argument_form(&$form, &$form_state) {
if
(
!
empty
(
$info
[
'no_ui'
]))
{
continue
;
}
$plugin
=
$this
->
get_plugin
(
'argument
default'
,
$id
);
$plugin
=
$this
->
get_plugin
(
'argument
_
default'
,
$id
);
if
(
$plugin
)
{
if
(
$plugin
->
access
()
||
$this
->
options
[
'default_argument_type'
]
==
$id
)
{
$form
[
'argument_default'
][
'#argument_option'
]
=
'default'
;
...
...
@@ -805,7 +805,7 @@ function has_default_argument() {
* Get a default argument, if available.
*/
function
get_default_argument
()
{
$plugin
=
$this
->
get_plugin
(
'argument
default'
);
$plugin
=
$this
->
get_plugin
(
'argument
_
default'
);
if
(
$plugin
)
{
return
$plugin
->
get_argument
();
}
...
...
@@ -819,7 +819,7 @@ function get_default_argument() {
*/
function
process_summary_arguments
(
&
$args
)
{
if
(
$this
->
options
[
'validate'
][
'type'
]
!=
'none'
)
{
if
(
isset
(
$this
->
validator
)
||
$this
->
validator
=
$this
->
get_plugin
(
'argument
validator'
))
{
if
(
isset
(
$this
->
validator
)
||
$this
->
validator
=
$this
->
get_plugin
(
'argument
_
validator'
))
{
$this
->
validator
->
process_summary_arguments
(
$args
);
}
}
...
...
@@ -1016,7 +1016,7 @@ function validate_arg($arg) {
return
$this
->
argument_validated
=
$this
->
validate_argument_basic
(
$arg
);
}
$plugin
=
$this
->
get_plugin
(
'argument
validator'
);
$plugin
=
$this
->
get_plugin
(
'argument
_
validator'
);
if
(
$plugin
)
{
return
$this
->
argument_validated
=
$plugin
->
validate_argument
(
$arg
);
}
...
...
@@ -1154,7 +1154,7 @@ function export_validation($indent, $prefix, $storage, $option, $definition, $pa
$name
=
$this
->
options
[
'validate'
][
$option
];
$options
=
$this
->
options
[
'validate_options'
];
$plugin
=
views_get_plugin
(
'argument
validator'
,
$name
);
$plugin
=
views_get_plugin
(
'argument
_
validator'
,
$name
);
if
(
$plugin
)
{
$plugin
->
init
(
$this
->
view
,
$this
->
display
,
$options
);
// Write which plugin to use.
...
...
@@ -1176,7 +1176,7 @@ function export_validation($indent, $prefix, $storage, $option, $definition, $pa
function
export_plugin
(
$indent
,
$prefix
,
$storage
,
$option
,
$definition
,
$parents
)
{
$output
=
''
;
if
(
$option
==
'default_argument_type'
)
{
$type
=
'argument
default'
;
$type
=
'argument
_
default'
;
$option_name
=
'default_argument_options'
;
}
...
...
@@ -1197,14 +1197,14 @@ function export_plugin($indent, $prefix, $storage, $option, $definition, $parent
/**
* Get the display or row plugin, if it exists.
*/
function
get_plugin
(
$type
=
'argument
default'
,
$name
=
NULL
)
{
function
get_plugin
(
$type
=
'argument
_
default'
,
$name
=
NULL
)
{
$options
=
array
();
switch
(
$type
)
{
case
'argument
default'
:
case
'argument
_
default'
:
$plugin_name
=
$this
->
options
[
'default_argument_type'
];
$options_name
=
'default_argument_options'
;
break
;
case
'argument
validator'
:
case
'argument
_
validator'
:
$plugin_name
=
$this
->
options
[
'validate'
][
'type'
];
$options_name
=
'validate_options'
;
break
;
...
...
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