Commit b4634929 authored by webchick's avatar webchick

#728566 by Dave Reid: Fixed Incorrect colspan for content row when there are no aliases.

parent 3d77abdd
...@@ -19,14 +19,13 @@ function path_admin_overview($keys = NULL) { ...@@ -19,14 +19,13 @@ function path_admin_overview($keys = NULL) {
$alias_exists = (bool) db_query_range('SELECT 1 FROM {url_alias} WHERE language <> :language', 0, 1, array(':language' => LANGUAGE_NONE))->fetchField(); $alias_exists = (bool) db_query_range('SELECT 1 FROM {url_alias} WHERE language <> :language', 0, 1, array(':language' => LANGUAGE_NONE))->fetchField();
$multilanguage = (module_exists('locale') || $alias_exists); $multilanguage = (module_exists('locale') || $alias_exists);
$header = array( $header = array();
array('data' => t('Alias'), 'field' => 'alias', 'sort' => 'asc'), $header[] = array('data' => t('Alias'), 'field' => 'alias', 'sort' => 'asc');
array('data' => t('System'), 'field' => 'source'), $header[] = array('data' => t('System'), 'field' => 'source');
array('data' => t('Operations'), 'colspan' => '2')
);
if ($multilanguage) { if ($multilanguage) {
array_splice($header, 2, 0, array(array('data' => t('Language'), 'field' => 'language'))); $header[] = array('data' => t('Language'), 'field' => 'language');
} }
$header[] = array('data' => t('Operations'));
$query = db_select('url_alias')->extend('PagerDefault')->extend('TableSort'); $query = db_select('url_alias')->extend('PagerDefault')->extend('TableSort');
if ($keys) { if ($keys) {
...@@ -42,22 +41,38 @@ function path_admin_overview($keys = NULL) { ...@@ -42,22 +41,38 @@ function path_admin_overview($keys = NULL) {
$rows = array(); $rows = array();
$destination = drupal_get_destination(); $destination = drupal_get_destination();
foreach ($result as $data) { foreach ($result as $data) {
$row = array( $row = array();
$row['data']['alias'] = l($data->alias, $data->source);
$row['data']['source'] = l($data->source, $data->source, array('alias' => TRUE));
if ($multilanguage) {
$row['data']['language'] = module_invoke('locale', 'language_name', $data->language);
}
$operations = array();
$operations['edit'] = array(
'title' => t('edit'),
'href' => "admin/config/search/path/edit/$data->pid",
'query' => $destination,
);
$operations['delete'] = array(
'title' => t('delete'),
'href' => "admin/config/search/path/delete/$data->pid",
'query' => $destination,
);
$row['data']['operations'] = array(
'data' => array( 'data' => array(
l($data->alias, $data->source), '#theme' => 'links',
l($data->source, $data->source, array('alias' => TRUE)), '#links' => $operations,
l(t('edit'), "admin/config/search/path/edit/$data->pid", array('query' => $destination)), '#attributes' => array('class' => array('links', 'inline', 'nowrap')),
l(t('delete'), "admin/config/search/path/delete/$data->pid", array('query' => $destination)),
), ),
); );
// If the system path maps to a different URL alias, highlight this table // If the system path maps to a different URL alias, highlight this table
// row to let the user know of old aliases. // row to let the user know of old aliases.
if ($data->alias != drupal_get_path_alias($data->source, $data->language)) { if ($data->alias != drupal_get_path_alias($data->source, $data->language)) {
$row['class'] = array('warning'); $row['class'] = array('warning');
} }
if ($multilanguage) {
array_splice($row['data'], 2, 0, module_invoke('locale', 'language_name', $data->language));
}
$rows[] = $row; $rows[] = $row;
} }
...@@ -65,7 +80,7 @@ function path_admin_overview($keys = NULL) { ...@@ -65,7 +80,7 @@ function path_admin_overview($keys = NULL) {
'#theme' => 'table', '#theme' => 'table',
'#header' => $header, '#header' => $header,
'#rows' => $rows, '#rows' => $rows,
'#empty' => t('No URL aliases available. <a href="@link">Add alias</a>.', array('@link' => url('admin/config/search/path/add'))), '#empty' => t('No URL aliases available. <a href="@link">Add URL alias</a>.', array('@link' => url('admin/config/search/path/add'))),
); );
$build['path_pager'] = array('#theme' => 'pager'); $build['path_pager'] = array('#theme' => 'pager');
......
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