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
56741a09
Commit
56741a09
authored
Mar 28, 2012
by
Jennifer Hodgdon
Browse files
Issue
#1355682
by chertzog: Clean up API docs for the Path module
parent
72f97d9a
Changes
5
Hide whitespace changes
Inline
Side-by-side
core/modules/path/path.admin.inc
View file @
56741a09
...
...
@@ -6,7 +6,7 @@
*/
/**
* Return a listing of all defined URL aliases.
* Return
s
a listing of all defined URL aliases.
*
* When filter key passed, perform a standard search on the given key,
* and return the list of matching URL aliases.
...
...
@@ -88,7 +88,15 @@ function path_admin_overview($keys = NULL) {
}
/**
* Menu callback; handles pages for creating and editing URL aliases.
* Page callback: Returns a form creating or editing a path alias.
*
* @param $path
* An array containing the path ID, source, alias, and language code.
*
* @return
* A form for adding or editing a URL alias.
*
* @see path_menu()
*/
function
path_admin_edit
(
$path
=
array
())
{
if
(
$path
)
{
...
...
@@ -103,11 +111,15 @@ function path_admin_edit($path = array()) {
}
/**
* Return a form for editing or creating an individual URL alias.
* Form constructor for the path administration form.
*
* @param $path
* An array containing the path ID, source, alias, and language code.
*
* @ingroup forms
* @see path_admin_form_validate()
* @see path_admin_form_submit()
* @see path_admin_form_delete_submit()
*/
function
path_admin_form
(
$form
,
&
$form_state
,
$path
=
array
(
'source'
=>
''
,
'alias'
=>
''
,
'langcode'
=>
LANGUAGE_NOT_SPECIFIED
,
'pid'
=>
NULL
))
{
$form
[
'source'
]
=
array
(
...
...
@@ -177,7 +189,10 @@ function path_admin_form($form, &$form_state, $path = array('source' => '', 'ali
}
/**
* Submit function for the 'Delete' button on the URL alias editing form.
* Form submission handler for the 'Delete' button on path_admin_form().
*
* @see path_admin_form_validate()
* @see path_admin_form_submit()
*/
function
path_admin_form_delete_submit
(
$form
,
&
$form_state
)
{
$destination
=
array
();
...
...
@@ -189,7 +204,10 @@ function path_admin_form_delete_submit($form, &$form_state) {
}
/**
* Verify that a URL alias is valid
* Form validation handler for path_admin_form().
*
* @see path_admin_form_submit()
* @see path_admin_form_delete_submit()
*/
function
path_admin_form_validate
(
$form
,
&
$form_state
)
{
$source
=
&
$form_state
[
'values'
][
'source'
];
...
...
@@ -216,7 +234,10 @@ function path_admin_form_validate($form, &$form_state) {
}
/**
* Save a URL alias to the database.
* Form submission handler for path_admin_form().
*
* @see path_admin_form_validate()
* @see path_admin_form_delete_submit()
*/
function
path_admin_form_submit
(
$form
,
&
$form_state
)
{
// Remove unnecessary values.
...
...
@@ -229,7 +250,12 @@ function path_admin_form_submit($form, &$form_state) {
}
/**
* Menu callback; confirms deleting an URL alias
* Form constructor for the path deletion form.
*
* @param $path
* The path alias that will be deleted.
*
* @see path_admin_delete_confirm_submit()
*/
function
path_admin_delete_confirm
(
$form
,
&
$form_state
,
$path
)
{
if
(
user_access
(
'administer url aliases'
))
{
...
...
@@ -245,7 +271,7 @@ function path_admin_delete_confirm($form, &$form_state, $path) {
}
/**
*
Execute URL alias deletion
*
Form submission handler for path_admin_delete_confirm().
*/
function
path_admin_delete_confirm_submit
(
$form
,
&
$form_state
)
{
if
(
$form_state
[
'values'
][
'confirm'
])
{
...
...
@@ -255,10 +281,11 @@ function path_admin_delete_confirm_submit($form, &$form_state) {
}
/**
*
Return a form to filter URL aliases
.
*
Form constructor for the path admin overview filter form
.
*
* @ingroup forms
* @see path_admin_filter_form_submit()
* @see path_admin_filter_form_submit_filter()
* @see path_admin_filter_form_submit_reset()
*/
function
path_admin_filter_form
(
$form
,
&
$form_state
,
$keys
=
''
)
{
$form
[
'#attributes'
]
=
array
(
'class'
=>
array
(
'search-form'
));
...
...
@@ -290,14 +317,18 @@ function path_admin_filter_form($form, &$form_state, $keys = '') {
}
/**
* Process filter form submission when the Filter button is pressed.
* Form submission handler for the path_admin_filter_form() Filter button.
*
* @see path_admin_filter_form_submit_reset()
*/
function
path_admin_filter_form_submit_filter
(
$form
,
&
$form_state
)
{
$form_state
[
'redirect'
]
=
'admin/config/search/path/list/'
.
trim
(
$form_state
[
'values'
][
'filter'
]);
}
/**
* Process filter form submission when the Reset button is pressed.
* Form submission handler for the path_admin_filter_form() Reset button.
*
* @see path_admin_filter_form_submit_filter()
*/
function
path_admin_filter_form_submit_reset
(
$form
,
&
$form_state
)
{
$form_state
[
'redirect'
]
=
'admin/config/search/path/list'
;
...
...
core/modules/path/path.api.php
View file @
56741a09
...
...
@@ -10,9 +10,8 @@
* @{
*/
/**
*
Allow modules to r
espond to a path being inserted.
*
R
espond to a path being inserted.
*
* @param $path
* An associative array containing the following keys:
...
...
@@ -33,7 +32,7 @@ function hook_path_insert($path) {
}
/**
*
Allow modules to r
espond to a path being updated.
*
R
espond to a path being updated.
*
* @param $path
* An associative array containing the following keys:
...
...
@@ -52,7 +51,7 @@ function hook_path_update($path) {
}
/**
*
Allow modules to r
espond to a path being deleted.
*
R
espond to a path being deleted.
*
* @param $path
* An associative array containing the following keys:
...
...
core/modules/path/path.js
View file @
56741a09
/**
* @file
* Attaches behaviors for the Path module.
*/
(
function
(
$
)
{
Drupal
.
behaviors
.
pathFieldsetSummaries
=
{
...
...
core/modules/path/path.module
View file @
56741a09
...
...
@@ -91,7 +91,9 @@ function path_menu() {
}
/**
* Implements hook_form_BASE_FORM_ID_alter().
* Implements hook_form_BASE_FORM_ID_alter() for node_form().
*
* @see path_form_element_validate()
*/
function
path_form_node_form_alter
(
&
$form
,
$form_state
)
{
$path
=
array
();
...
...
@@ -145,6 +147,8 @@ function path_form_node_form_alter(&$form, $form_state) {
/**
* Form element validation handler for URL alias form element.
*
* @see path_form_node_form_alter()
*/
function
path_form_element_validate
(
$element
,
&
$form_state
,
$complete_form
)
{
if
(
!
empty
(
$form_state
[
'values'
][
'path'
][
'alias'
]))
{
...
...
@@ -225,7 +229,7 @@ function path_node_predelete($node) {
}
/**
* Implements hook_form_FORM_ID_alter().
* Implements hook_form_FORM_ID_alter()
for taxonomy_form_term()
.
*/
function
path_form_taxonomy_form_term_alter
(
&
$form
,
$form_state
)
{
// Make sure this does not show up on the delete confirmation form.
...
...
core/modules/path/path.test
View file @
56741a09
...
...
@@ -2,9 +2,12 @@
/**
* @file
* Tests for
p
ath
.
module.
* Tests for
the P
ath
module.
*/
/**
* Provides a base class for testing the Path module.
*/
class
PathTestCase
extends
DrupalWebTestCase
{
function
setUp
()
{
$modules
=
func_get_args
();
...
...
@@ -23,6 +26,9 @@ class PathTestCase extends DrupalWebTestCase {
}
}
/**
* Tests path alias functionality.
*/
class
PathAliasTestCase
extends
PathTestCase
{
public
static
function
getInfo
()
{
return
array
(
...
...
@@ -41,7 +47,7 @@ class PathAliasTestCase extends PathTestCase {
}
/**
* Test the path cache.
* Test
s
the path cache.
*/
function
testPathCache
()
{
// Create test node.
...
...
@@ -66,7 +72,7 @@ class PathAliasTestCase extends PathTestCase {
}
/**
* Test alias functionality through the admin interfaces.
* Test
s
alias functionality through the admin interfaces.
*/
function
testAdminAlias
()
{
// Create test node.
...
...
@@ -125,7 +131,7 @@ class PathAliasTestCase extends PathTestCase {
}
/**
* Test alias functionality through the node interfaces.
* Test
s
alias functionality through the node interfaces.
*/
function
testNodeAlias
()
{
// Create test node.
...
...
@@ -177,6 +183,15 @@ class PathAliasTestCase extends PathTestCase {
$this
->
assertResponse
(
404
);
}
/**
* Returns the path ID.
*
* @param $alias
* A string containing an aliased path.
*
* @return int
* Integer representing the path ID.
*/
function
getPID
(
$alias
)
{
return
db_query
(
"SELECT pid FROM
{
url_alias
}
WHERE alias = :alias"
,
array
(
':alias'
=>
$alias
))
->
fetchField
();
}
...
...
@@ -200,7 +215,7 @@ class PathAliasTestCase extends PathTestCase {
}
/**
* Test URL aliases for taxonomy terms.
* Test
s
URL aliases for taxonomy terms.
*/
class
PathTaxonomyTermTestCase
extends
PathTestCase
{
public
static
function
getInfo
()
{
...
...
@@ -227,7 +242,7 @@ class PathTaxonomyTermTestCase extends PathTestCase {
}
/**
* Test alias functionality through the admin interfaces.
* Test
s
alias functionality through the admin interfaces.
*/
function
testTermAlias
()
{
// Create a term in the default 'Tags' vocabulary with URL alias.
...
...
@@ -270,6 +285,9 @@ class PathTaxonomyTermTestCase extends PathTestCase {
}
}
/**
* Tests URL aliases for translated nodes.
*/
class
PathLanguageTestCase
extends
PathTestCase
{
public
static
function
getInfo
()
{
return
array
(
...
...
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