Commit a99287e9 authored by Dave Reid's avatar Dave Reid

by Dave Reid: Added missing breadcrumbs to local action and callback pages.

parent f110abdf
......@@ -80,7 +80,7 @@ function xmlsitemap_sitemap_list_form() {
$operations = array();
$operations['edit'] = array(
'title' => t('Edit'),
'href' => 'admin/settings/xmlsitemap/edit/' . $smid,
'href' => 'admin/config/search/xmlsitemap/edit/' . $smid,
'query' => $destination,
);
$operations['delete'] = array(
......@@ -112,9 +112,9 @@ function xmlsitemap_sitemap_list_form() {
}
/**
* Validate xmlsitemap_sitemap_list_form form submissions.
* Validate xmlsitemap_sitemap_list_form submissions.
*/
function xmlsitemap_sitemap_list_validate($form, &$form_state) {
function xmlsitemap_sitemap_list_form_validate($form, &$form_state) {
$form_state['values']['sitemaps'] = array_filter($form_state['values']['sitemaps']);
// Error if there are no items to select.
......@@ -124,11 +124,11 @@ function xmlsitemap_sitemap_list_validate($form, &$form_state) {
}
/**
* Process xmlsitemap_sitemap_list_form form submissions.
* Process xmlsitemap_sitemap_list_form submissions.
*
* Execute the chosen 'Update option' on the selected sitemaps.
*/
function xmlsitemap_sitemap_list_submit($form, &$form_state) {
function xmlsitemap_sitemap_list_form_submit($form, &$form_state) {
$operation = $form['#operations'][$form_state['values']['operation']];
// Filter out unchecked sitemaps.
......@@ -158,7 +158,27 @@ function xmlsitemap_sitemap_list_submit($form, &$form_state) {
}
}
/**
* Workaround for missing breadcrumbs on callback and action paths.
*
* @todo Remove when http://drupal.org/node/576290 is fixed.
*/
function _xmlsitemap_set_breadcrumb($path = 'admin/config/search/xmlsitemap') {
$breadcrumb = array();
$path = explode('/', $path);
do {
$menu_path = implode('/', $path);
$menu_item = menu_get_item($menu_path);
array_unshift($breadcrumb, l($menu_item['title'], $menu_path));
} while (array_pop($path) && !empty($path));
array_unshift($breadcrumb, l(t('Home'), NULL));
drupal_set_breadcrumb($breadcrumb);
}
function xmlsitemap_sitemap_edit_form(&$form, $form_state, array $sitemap = array()) {
// @todo Remove when http://drupal.org/node/576290 is fixed.
_xmlsitemap_set_breadcrumb();
$sitemap += array(
'smid' => NULL,
'context' => array(),
......@@ -226,6 +246,9 @@ function xmlsitemap_sitemap_edit_form_submit($form, &$form_state) {
}
function xmlsitemap_sitemap_delete_form(&$form, $form_state, array $sitemap) {
// @todo Remove when http://drupal.org/node/576290 is fixed.
_xmlsitemap_set_breadcrumb();
$count = (int) db_query("SELECT COUNT(smid) FROM {xmlsitemap_sitemap}")->fetchField();
if ($count === 1 && empty($_POST)) {
drupal_set_message('It is not recommended to delete the only XML sitemap.', 'error');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment