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
aab7094c
Commit
aab7094c
authored
Mar 30, 2013
by
Angie Byron
Browse files
Issue
#1952842
by tim.plunkett: Fixed Views UI still uses NOT_USED for page callbacks.
parent
537362c1
Changes
3
Hide whitespace changes
Inline
Side-by-side
core/modules/system/lib/Drupal/system/Tests/Menu/LocalTasksTest.php
View file @
aab7094c
...
...
@@ -7,12 +7,10 @@
namespace
Drupal\system\Tests\Menu
;
use
Drupal\simpletest\WebTestBase
;
/**
* Tests local tasks derived from router and added/altered via hooks.
*/
class
LocalTasksTest
extends
Web
TestBase
{
class
LocalTasksTest
extends
Menu
TestBase
{
public
static
$modules
=
array
(
'menu_test'
);
...
...
@@ -114,30 +112,4 @@ function testLocalTasks() {
$this
->
assertText
(
'Advanced settings'
);
}
/**
* Asserts local tasks in the page output.
*
* @param array $hrefs
* A list of expected link hrefs of local tasks to assert on the page (in
* the given order).
* @param int $level
* (optional) The local tasks level to assert; 0 for primary, 1 for
* secondary. Defaults to 0.
*/
protected
function
assertLocalTasks
(
array
$hrefs
,
$level
=
0
)
{
$elements
=
$this
->
xpath
(
'//*[contains(@class, :class)]//a'
,
array
(
':class'
=>
$level
==
0
?
'tabs primary'
:
'tabs secondary'
,
));
$this
->
assertTrue
(
count
(
$elements
),
'Local tasks found.'
);
foreach
(
$hrefs
as
$index
=>
$element
)
{
$expected
=
url
(
$hrefs
[
$index
]);
$method
=
(
$elements
[
$index
][
'href'
]
==
$expected
?
'pass'
:
'fail'
);
$this
->
{
$method
}(
format_string
(
'Task @number href @value equals @expected.'
,
array
(
'@number'
=>
$index
+
1
,
'@value'
=>
(
string
)
$elements
[
$index
][
'href'
],
'@expected'
=>
$expected
,
)));
}
}
}
core/modules/system/lib/Drupal/system/Tests/Menu/MenuTestBase.php
View file @
aab7094c
...
...
@@ -116,4 +116,31 @@ protected function getParts() {
}
return
$parts
;
}
/**
* Asserts local tasks in the page output.
*
* @param array $hrefs
* A list of expected link hrefs of local tasks to assert on the page (in
* the given order).
* @param int $level
* (optional) The local tasks level to assert; 0 for primary, 1 for
* secondary. Defaults to 0.
*/
protected
function
assertLocalTasks
(
array
$hrefs
,
$level
=
0
)
{
$elements
=
$this
->
xpath
(
'//*[contains(@class, :class)]//a'
,
array
(
':class'
=>
$level
==
0
?
'tabs primary'
:
'tabs secondary'
,
));
$this
->
assertTrue
(
count
(
$elements
),
'Local tasks found.'
);
foreach
(
$hrefs
as
$index
=>
$element
)
{
$expected
=
url
(
$hrefs
[
$index
]);
$method
=
(
$elements
[
$index
][
'href'
]
==
$expected
?
'pass'
:
'fail'
);
$this
->
{
$method
}(
format_string
(
'Task @number href @value equals @expected.'
,
array
(
'@number'
=>
$index
+
1
,
'@value'
=>
(
string
)
$elements
[
$index
][
'href'
],
'@expected'
=>
$expected
,
)));
}
}
}
core/modules/views/views_ui/views_ui.module
View file @
aab7094c
...
...
@@ -19,95 +19,80 @@ function views_ui_menu() {
$items
=
array
();
// Top-level Views module pages (not tied to a particular View).
$items
[
'admin/structure/views/add'
]
=
array
(
'title'
=>
'Add new view'
,
'page callback'
=>
'NOT_USED'
,
'type'
=>
MENU_LOCAL_ACTION
,
'access arguments'
=>
array
(
'administer views'
),
);
$items
[
'admin/structure/views'
]
=
array
(
'title'
=>
'Views'
,
'description'
=>
'Manage customized lists of content.'
,
'page callback'
=>
'NOT_USED'
,
'access arguments'
=>
array
(
'administer views'
),
'route_name'
=>
'views_ui.list'
,
);
$items
[
'admin/structure/views/list'
]
=
array
(
'title'
=>
'List'
,
'type'
=>
MENU_DEFAULT_LOCAL_TASK
,
'access arguments'
=>
array
(
'administer views'
),
);
$items
[
'admin/structure/views/add'
]
=
array
(
'title'
=>
'Add new view'
,
'route_name'
=>
'views_ui.add'
,
'type'
=>
MENU_LOCAL_ACTION
,
);
$items
[
'admin/structure/views/settings'
]
=
array
(
'title'
=>
'Settings'
,
'
page callback'
=>
'NOT_USED
'
,
'
route_name'
=>
'views_ui.settings.basic
'
,
'type'
=>
MENU_LOCAL_TASK
,
'access arguments'
=>
array
(
'administer views'
),
);
$items
[
'admin/structure/views/settings/basic'
]
=
array
(
'title'
=>
'Basic'
,
'type'
=>
MENU_DEFAULT_LOCAL_TASK
,
'access arguments'
=>
array
(
'administer views'
),
);
$items
[
'admin/structure/views/settings/advanced'
]
=
array
(
'title'
=>
'Advanced'
,
'route_name'
=>
'views_ui.settings.advanced'
,
'type'
=>
MENU_LOCAL_TASK
,
'weight'
=>
1
,
'access arguments'
=>
array
(
'administer views'
),
);
// The primary Edit View page. Secondary tabs for each Display are added in
// views_ui_menu_local_tasks_alter().
$items
[
'admin/structure/views/view/%'
]
=
array
(
'page callback'
=>
'NOT_USED'
,
'access arguments'
=>
array
(
'administer views'
),
'route_name'
=>
'views_ui.edit'
,
);
$items
[
'admin/structure/views/view/%/edit'
]
=
array
(
'title'
=>
'Edit view'
,
'type'
=>
MENU_DEFAULT_LOCAL_TASK
,
'context'
=>
MENU_CONTEXT_PAGE
|
MENU_CONTEXT_INLINE
,
'access arguments'
=>
array
(
'administer views'
),
);
$items
[
'admin/structure/views/view/%/preview/%'
]
=
array
(
'
page callback'
=>
'NOT_USED
'
,
'
route_name'
=>
'views_ui.preview
'
,
'context'
=>
MENU_CONTEXT_PAGE
|
MENU_CONTEXT_INLINE
,
'type'
=>
MENU_VISIBLE_IN_BREADCRUMB
,
'access arguments'
=>
array
(
'administer views'
),
);
// Additional pages for acting on a View.
$items
[
'admin/structure/views/view/%/break-lock'
]
=
array
(
'title'
=>
'Break lock'
,
'
page callback'
=>
'NOT_USED
'
,
'
route_name'
=>
'views_ui.breakLock
'
,
'type'
=>
MENU_VISIBLE_IN_BREADCRUMB
,
'access arguments'
=>
array
(
'administer views'
),
);
// NoJS/AJAX callbacks that can use the default Views AJAX form system.
$items
[
'admin/structure/views/nojs/%/%'
]
=
array
(
'page callback'
=>
'NOT_USED'
,
'type'
=>
MENU_VISIBLE_IN_BREADCRUMB
,
'access arguments'
=>
array
(
'administer views'
),
);
// A page in the Reports section to show usage of fields in all views
$items
[
'admin/reports/fields/views-fields'
]
=
array
(
'title'
=>
'Used in views'
,
'description'
=>
'Overview of fields used in all views.'
,
'
page callback'
=>
'NOT_USED
'
,
'
route_name'
=>
'views_ui.reports.fields
'
,
'type'
=>
MENU_LOCAL_TASK
,
'access arguments'
=>
array
(
'administer views'
),
);
// A page in the Reports section to show usage of plugins in all views.
$items
[
'admin/reports/views-plugins'
]
=
array
(
'title'
=>
'Views plugins'
,
'description'
=>
'Overview of plugins used in all views.'
,
'page callback'
=>
'NOT_USED'
,
'access arguments'
=>
array
(
'administer views'
),
'route_name'
=>
'views_ui.reports.plugins'
,
);
return
$items
;
...
...
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