Commit 59aa2ae8 authored by drumm's avatar drumm

#71925 by Steven, remove # prefix from link array keys.

parent c21db64a
......@@ -497,20 +497,20 @@ function theme_links($links, $delimiter = ' | ') {
if (is_array($links)) {
foreach ($links as $key => $link) {
//Automatically add a class to each link and convert all _ to - for XHTML compliance
if (isset($link['#attributes']) && isset($link['#attributes']['class'])) {
$link['#attributes']['class'] .= ' '. str_replace('_', '-', $key);
// Automatically add a class to each link and convert all _ to - for XHTML compliance
if (isset($link['attributes']) && isset($link['attributes']['class'])) {
$link['attributes']['class'] .= ' '. str_replace('_', '-', $key);
}
else {
$link['#attributes']['class'] = str_replace('_', '-', $key);
$link['attributes']['class'] = str_replace('_', '-', $key);
}
if ($link['#href']) {
$output[] = l($link['#title'], $link['#href'], $link['#attributes'], $link['#query'], $link['#fragment']);
if ($link['href']) {
$output[] = l($link['title'], $link['href'], $link['attributes'], $link['query'], $link['fragment']);
}
else if ($link['#title']) {
else if ($link['title']) {
//Some links are actually not links, but we wrap these in <span> for adding title and class attributes
$output[] = '<span'. drupal_attributes($link['#attributes']) .'>'. $link['#title'] .'</span>';
$output[] = '<span'. drupal_attributes($link['attributes']) .'>'. check_plain($link['title']) .'</span>';
}
}
}
......
......@@ -1151,8 +1151,8 @@ function aggregator_page_sources() {
$output .= theme('item_list', $list);
$link['sources'] = array(
'#title' => t('more'),
'#href' => 'aggregator/sources/'. $feed->fid
'title' => t('more'),
'href' => 'aggregator/sources/'. $feed->fid
);
$output .= '<div class="links">'. theme('links', $link) ."</div>\n";
......@@ -1255,8 +1255,8 @@ function aggregator_page_categories() {
}
$link['categories'] = array(
'#title' => t('more'),
'#href' => 'aggregator/categories/'. $category->cid
'title' => t('more'),
'href' => 'aggregator/categories/'. $category->cid
);
$output .= '<div class="links">'. theme('links', $link) ."</div>\n";
......
......@@ -1151,8 +1151,8 @@ function aggregator_page_sources() {
$output .= theme('item_list', $list);
$link['sources'] = array(
'#title' => t('more'),
'#href' => 'aggregator/sources/'. $feed->fid
'title' => t('more'),
'href' => 'aggregator/sources/'. $feed->fid
);
$output .= '<div class="links">'. theme('links', $link) ."</div>\n";
......@@ -1255,8 +1255,8 @@ function aggregator_page_categories() {
}
$link['categories'] = array(
'#title' => t('more'),
'#href' => 'aggregator/categories/'. $category->cid
'title' => t('more'),
'href' => 'aggregator/categories/'. $category->cid
);
$output .= '<div class="links">'. theme('links', $link) ."</div>\n";
......
......@@ -250,9 +250,9 @@ function blog_link($type, $node = 0, $main = 0) {
if ($type == 'node' && $node->type == 'blog') {
if (arg(0) != 'blog' || arg(1) != $node->uid) {
$links['blog_usernames_blog'] = array(
'#title' => t("%username's blog", array('%username' => $node->name)),
'#href' => "blog/$node->uid",
'#attributes' => array('title' => t("Read %username's latest blog entries.", array('%username' => $node->name)))
'title' => t("%username's blog", array('%username' => $node->name)),
'href' => "blog/$node->uid",
'attributes' => array('title' => t("Read %username's latest blog entries.", array('%username' => $node->name)))
);
}
}
......
......@@ -250,9 +250,9 @@ function blog_link($type, $node = 0, $main = 0) {
if ($type == 'node' && $node->type == 'blog') {
if (arg(0) != 'blog' || arg(1) != $node->uid) {
$links['blog_usernames_blog'] = array(
'#title' => t("%username's blog", array('%username' => $node->name)),
'#href' => "blog/$node->uid",
'#attributes' => array('title' => t("Read %username's latest blog entries.", array('%username' => $node->name)))
'title' => t("%username's blog", array('%username' => $node->name)),
'href' => "blog/$node->uid",
'attributes' => array('title' => t("Read %username's latest blog entries.", array('%username' => $node->name)))
);
}
}
......
......@@ -59,15 +59,15 @@ function book_link($type, $node = 0, $main = 0) {
if (!$main) {
if (book_access('create', $node)) {
$links['book_add_child'] = array(
'#title' => t('add child page'),
'#href' => "node/add/book/parent/$node->nid"
'title' => t('add child page'),
'href' => "node/add/book/parent/$node->nid"
);
}
if (user_access('see printer-friendly version')) {
$links['book_printer'] = array(
'#title' => t('printer-friendly version'),
'#href' => 'book/export/html/'. $node->nid,
'#attributes' => array('title' => t('Show a printer-friendly version of this book page and its sub-pages.'))
'title' => t('printer-friendly version'),
'href' => 'book/export/html/'. $node->nid,
'attributes' => array('title' => t('Show a printer-friendly version of this book page and its sub-pages.'))
);
}
}
......
......@@ -59,15 +59,15 @@ function book_link($type, $node = 0, $main = 0) {
if (!$main) {
if (book_access('create', $node)) {
$links['book_add_child'] = array(
'#title' => t('add child page'),
'#href' => "node/add/book/parent/$node->nid"
'title' => t('add child page'),
'href' => "node/add/book/parent/$node->nid"
);
}
if (user_access('see printer-friendly version')) {
$links['book_printer'] = array(
'#title' => t('printer-friendly version'),
'#href' => 'book/export/html/'. $node->nid,
'#attributes' => array('title' => t('Show a printer-friendly version of this book page and its sub-pages.'))
'title' => t('printer-friendly version'),
'href' => 'book/export/html/'. $node->nid,
'attributes' => array('title' => t('Show a printer-friendly version of this book page and its sub-pages.'))
);
}
}
......
......@@ -196,18 +196,18 @@ function comment_link($type, $node = 0, $main = 0) {
if ($all) {
$links['comment_comments'] = array(
'#title' => format_plural($all, '1 comment', '%count comments'),
'#href' => "node/$node->nid",
'#attributes' => array('title' => t('Jump to the first comment of this posting.')),
'#fragment' => 'comment'
'title' => format_plural($all, '1 comment', '%count comments'),
'href' => "node/$node->nid",
'attributes' => array('title' => t('Jump to the first comment of this posting.')),
'fragment' => 'comment'
);
if ($new) {
$links['comment_new_comments'] = array(
'#title' => format_plural($new, '1 new comment', '%count new comments'),
'#href' => "node/$node->nid",
'#attributes' => array('title' => t('Jump to the first new comment of this posting.')),
'#fragment' => 'new'
'title' => format_plural($new, '1 new comment', '%count new comments'),
'href' => "node/$node->nid",
'attributes' => array('title' => t('Jump to the first new comment of this posting.')),
'fragment' => 'new'
);
}
}
......@@ -215,10 +215,10 @@ function comment_link($type, $node = 0, $main = 0) {
if ($node->comment == COMMENT_NODE_READ_WRITE) {
if (user_access('post comments')) {
$links['comment_add'] = array(
'#title' => t('add new comment'),
'#href' => "comment/reply/$node->nid",
'#attributes' => array('title' => t('Add a new comment to this page.')),
'#fragment' => 'comment_form'
'title' => t('add new comment'),
'href' => "comment/reply/$node->nid",
'attributes' => array('title' => t('Add a new comment to this page.')),
'fragment' => 'comment_form'
);
}
else {
......@@ -236,10 +236,10 @@ function comment_link($type, $node = 0, $main = 0) {
if (user_access('post comments')) {
if (variable_get('comment_form_location', COMMENT_FORM_SEPARATE_PAGE) == COMMENT_FORM_SEPARATE_PAGE) {
$links['comment_add'] = array(
'#title' => t('add new comment'),
'#href' => "comment/reply/$node->nid",
'#attributes' => array('title' => t('Share your thoughts and opinions related to this posting.')),
'#fragment' => 'comment_form'
'title' => t('add new comment'),
'href' => "comment/reply/$node->nid",
'attributes' => array('title' => t('Share your thoughts and opinions related to this posting.')),
'fragment' => 'comment_form'
);
}
}
......@@ -689,37 +689,37 @@ function comment_links($comment, $return = 1) {
// If we are viewing just this comment, we link back to the node.
if ($return) {
$links['comment_parent'] = array(
'#title' => t('parent'),
'#href' => comment_node_url(),
'#fragment' => "comment-$comment->cid"
'title' => t('parent'),
'href' => comment_node_url(),
'fragment' => "comment-$comment->cid"
);
}
if (node_comment_mode($comment->nid) == COMMENT_NODE_READ_WRITE) {
if (user_access('administer comments') && user_access('post comments')) {
$links['comment_delete'] = array(
'#title' => t('delete'),
'#href' => "comment/delete/$comment->cid"
'title' => t('delete'),
'href' => "comment/delete/$comment->cid"
);
$links['comment_edit'] = array(
'#title' => t('edit'),
'#href' => "comment/edit/$comment->cid"
'title' => t('edit'),
'href' => "comment/edit/$comment->cid"
);
$links['comment_reply'] = array(
'#title' => t('reply'),
'#href' => "comment/reply/$comment->nid/$comment->cid"
'title' => t('reply'),
'href' => "comment/reply/$comment->nid/$comment->cid"
);
}
else if (user_access('post comments')) {
if (comment_access('edit', $comment)) {
$links['comment_edit'] = array(
'#title' => t('edit'),
'#href' => "comment/edit/$comment->cid"
'title' => t('edit'),
'href' => "comment/edit/$comment->cid"
);
}
$links['comment_reply'] = array(
'#title' => t('reply'),
'#href' => "comment/reply/$comment->nid/$comment->cid"
'title' => t('reply'),
'href' => "comment/reply/$comment->nid/$comment->cid"
);
}
else {
......
......@@ -196,18 +196,18 @@ function comment_link($type, $node = 0, $main = 0) {
if ($all) {
$links['comment_comments'] = array(
'#title' => format_plural($all, '1 comment', '%count comments'),
'#href' => "node/$node->nid",
'#attributes' => array('title' => t('Jump to the first comment of this posting.')),
'#fragment' => 'comment'
'title' => format_plural($all, '1 comment', '%count comments'),
'href' => "node/$node->nid",
'attributes' => array('title' => t('Jump to the first comment of this posting.')),
'fragment' => 'comment'
);
if ($new) {
$links['comment_new_comments'] = array(
'#title' => format_plural($new, '1 new comment', '%count new comments'),
'#href' => "node/$node->nid",
'#attributes' => array('title' => t('Jump to the first new comment of this posting.')),
'#fragment' => 'new'
'title' => format_plural($new, '1 new comment', '%count new comments'),
'href' => "node/$node->nid",
'attributes' => array('title' => t('Jump to the first new comment of this posting.')),
'fragment' => 'new'
);
}
}
......@@ -215,10 +215,10 @@ function comment_link($type, $node = 0, $main = 0) {
if ($node->comment == COMMENT_NODE_READ_WRITE) {
if (user_access('post comments')) {
$links['comment_add'] = array(
'#title' => t('add new comment'),
'#href' => "comment/reply/$node->nid",
'#attributes' => array('title' => t('Add a new comment to this page.')),
'#fragment' => 'comment_form'
'title' => t('add new comment'),
'href' => "comment/reply/$node->nid",
'attributes' => array('title' => t('Add a new comment to this page.')),
'fragment' => 'comment_form'
);
}
else {
......@@ -236,10 +236,10 @@ function comment_link($type, $node = 0, $main = 0) {
if (user_access('post comments')) {
if (variable_get('comment_form_location', COMMENT_FORM_SEPARATE_PAGE) == COMMENT_FORM_SEPARATE_PAGE) {
$links['comment_add'] = array(
'#title' => t('add new comment'),
'#href' => "comment/reply/$node->nid",
'#attributes' => array('title' => t('Share your thoughts and opinions related to this posting.')),
'#fragment' => 'comment_form'
'title' => t('add new comment'),
'href' => "comment/reply/$node->nid",
'attributes' => array('title' => t('Share your thoughts and opinions related to this posting.')),
'fragment' => 'comment_form'
);
}
}
......@@ -689,37 +689,37 @@ function comment_links($comment, $return = 1) {
// If we are viewing just this comment, we link back to the node.
if ($return) {
$links['comment_parent'] = array(
'#title' => t('parent'),
'#href' => comment_node_url(),
'#fragment' => "comment-$comment->cid"
'title' => t('parent'),
'href' => comment_node_url(),
'fragment' => "comment-$comment->cid"
);
}
if (node_comment_mode($comment->nid) == COMMENT_NODE_READ_WRITE) {
if (user_access('administer comments') && user_access('post comments')) {
$links['comment_delete'] = array(
'#title' => t('delete'),
'#href' => "comment/delete/$comment->cid"
'title' => t('delete'),
'href' => "comment/delete/$comment->cid"
);
$links['comment_edit'] = array(
'#title' => t('edit'),
'#href' => "comment/edit/$comment->cid"
'title' => t('edit'),
'href' => "comment/edit/$comment->cid"
);
$links['comment_reply'] = array(
'#title' => t('reply'),
'#href' => "comment/reply/$comment->nid/$comment->cid"
'title' => t('reply'),
'href' => "comment/reply/$comment->nid/$comment->cid"
);
}
else if (user_access('post comments')) {
if (comment_access('edit', $comment)) {
$links['comment_edit'] = array(
'#title' => t('edit'),
'#href' => "comment/edit/$comment->cid"
'title' => t('edit'),
'href' => "comment/edit/$comment->cid"
);
}
$links['comment_reply'] = array(
'#title' => t('reply'),
'#href' => "comment/reply/$comment->nid/$comment->cid"
'title' => t('reply'),
'href' => "comment/reply/$comment->nid/$comment->cid"
);
}
else {
......
......@@ -636,14 +636,14 @@ function _forum_parent_select($tid, $title, $child_type) {
}
function forum_link_alter(&$node, &$links) {
foreach ($links AS $module => $link) {
foreach ($links as $module => $link) {
if (strstr($module, 'taxonomy_term')) {
// Link back to the forum and not the taxonomy term page. We'll only
// do this if the taxonomy term in question belongs to forums.
$tid = str_replace('taxonomy/term/', '', $link['#href']);
$tid = str_replace('taxonomy/term/', '', $link['href']);
$term = taxonomy_get_term($tid);
if ($term->vid == _forum_get_vid()) {
$links[$module]['#href'] = str_replace('taxonomy/term', 'forum', $link['#href']);
$links[$module]['href'] = str_replace('taxonomy/term', 'forum', $link['href']);
}
}
}
......
......@@ -636,14 +636,14 @@ function _forum_parent_select($tid, $title, $child_type) {
}
function forum_link_alter(&$node, &$links) {
foreach ($links AS $module => $link) {
foreach ($links as $module => $link) {
if (strstr($module, 'taxonomy_term')) {
// Link back to the forum and not the taxonomy term page. We'll only
// do this if the taxonomy term in question belongs to forums.
$tid = str_replace('taxonomy/term/', '', $link['#href']);
$tid = str_replace('taxonomy/term/', '', $link['href']);
$term = taxonomy_get_term($tid);
if ($term->vid == _forum_get_vid()) {
$links[$module]['#href'] = str_replace('taxonomy/term', 'forum', $link['#href']);
$links[$module]['href'] = str_replace('taxonomy/term', 'forum', $link['href']);
}
}
}
......
......@@ -816,9 +816,9 @@ function node_link($type, $node = 0, $main = 0) {
if ($main == 1 && $node->teaser && $node->readmore) {
$links['node_read_more'] = array(
'#title' => t('read more'),
'#href' => "node/$node->nid",
'#attributes' => array('title' => t('Read the rest of this posting.'))
'title' => t('read more'),
'href' => "node/$node->nid",
'attributes' => array('title' => t('Read the rest of this posting.'))
);
}
}
......
......@@ -816,9 +816,9 @@ function node_link($type, $node = 0, $main = 0) {
if ($main == 1 && $node->teaser && $node->readmore) {
$links['node_read_more'] = array(
'#title' => t('read more'),
'#href' => "node/$node->nid",
'#attributes' => array('title' => t('Read the rest of this posting.'))
'title' => t('read more'),
'href' => "node/$node->nid",
'attributes' => array('title' => t('Read the rest of this posting.'))
);
}
}
......
......@@ -544,9 +544,9 @@ function poll_view(&$node, $teaser = FALSE, $page = FALSE, $block = FALSE) {
$node->body = $node->teaser = '';
$links = module_invoke_all('link', 'node', $node, 1);
$links[] = array('#title' => t('older polls'), '#href' => 'poll', '#attributes' => array('title' => t('View the list of polls on this site.')));
$links[] = array('title' => t('older polls'), 'href' => 'poll', 'attributes' => array('title' => t('View the list of polls on this site.')));
if ($node->allowvotes && $block) {
$links[] = array('#title' => t('results'), '#href' => 'node/'. $node->nid .'/results', '#attributes' => array('title' => t('View the current poll results.')));
$links[] = array('title' => t('results'), 'href' => 'node/'. $node->nid .'/results', 'attributes' => array('title' => t('View the current poll results.')));
}
$node->links = $links;
......
......@@ -544,9 +544,9 @@ function poll_view(&$node, $teaser = FALSE, $page = FALSE, $block = FALSE) {
$node->body = $node->teaser = '';
$links = module_invoke_all('link', 'node', $node, 1);
$links[] = array('#title' => t('older polls'), '#href' => 'poll', '#attributes' => array('title' => t('View the list of polls on this site.')));
$links[] = array('title' => t('older polls'), 'href' => 'poll', 'attributes' => array('title' => t('View the list of polls on this site.')));
if ($node->allowvotes && $block) {
$links[] = array('#title' => t('results'), '#href' => 'node/'. $node->nid .'/results', '#attributes' => array('title' => t('View the current poll results.')));
$links[] = array('title' => t('results'), 'href' => 'node/'. $node->nid .'/results', 'attributes' => array('title' => t('View the current poll results.')));
}
$node->links = $links;
......
......@@ -99,7 +99,7 @@ function statistics_link($type, $node = 0, $main = 0) {
if ($type != 'comment' && user_access('view post access counter')) {
$statistics = statistics_get($node->nid);
if ($statistics) {
$links['statistics_counter']['#title'] = format_plural($statistics['totalcount'], '1 read', '%count reads');
$links['statistics_counter']['title'] = format_plural($statistics['totalcount'], '1 read', '%count reads');
}
}
......
......@@ -99,7 +99,7 @@ function statistics_link($type, $node = 0, $main = 0) {
if ($type != 'comment' && user_access('view post access counter')) {
$statistics = statistics_get($node->nid);
if ($statistics) {
$links['statistics_counter']['#title'] = format_plural($statistics['totalcount'], '1 read', '%count reads');
$links['statistics_counter']['title'] = format_plural($statistics['totalcount'], '1 read', '%count reads');
}
}
......
......@@ -30,9 +30,9 @@ function taxonomy_link($type, $node = NULL) {
if (array_key_exists('taxonomy', $node)) {
foreach ($node->taxonomy as $term) {
$links['taxonomy_term_'. $term->tid] = array(
'#title' => $term->name,
'#href' => taxonomy_term_path($term),
'#attributes' => array('rel' => 'tag', 'title' => strip_tags($term->description))
'title' => $term->name,
'href' => taxonomy_term_path($term),
'attributes' => array('rel' => 'tag', 'title' => strip_tags($term->description))
);
}
}
......
......@@ -30,9 +30,9 @@ function taxonomy_link($type, $node = NULL) {
if (array_key_exists('taxonomy', $node)) {
foreach ($node->taxonomy as $term) {
$links['taxonomy_term_'. $term->tid] = array(
'#title' => $term->name,
'#href' => taxonomy_term_path($term),
'#attributes' => array('rel' => 'tag', 'title' => strip_tags($term->description))
'title' => $term->name,
'href' => taxonomy_term_path($term),
'attributes' => array('rel' => 'tag', 'title' => strip_tags($term->description))
);
}
}
......
......@@ -54,10 +54,10 @@ function upload_link($type, $node = 0, $main = 0) {
}
if ($num_files) {
$links['upload_attachments'] = array(
'#title' => format_plural($num_files, '1 attachment', '%count attachments'),
'#href' => "node/$node->nid",
'#attributes' => array('title' => t('Read full article to view attachments.')),
'#fragment' => 'attachments'
'title' => format_plural($num_files, '1 attachment', '%count attachments'),
'href' => "node/$node->nid",
'attributes' => array('title' => t('Read full article to view attachments.')),
'fragment' => 'attachments'
);
}
}
......
......@@ -54,10 +54,10 @@ function upload_link($type, $node = 0, $main = 0) {
}
if ($num_files) {
$links['upload_attachments'] = array(
'#title' => format_plural($num_files, '1 attachment', '%count attachments'),
'#href' => "node/$node->nid",
'#attributes' => array('title' => t('Read full article to view attachments.')),
'#fragment' => 'attachments'
'title' => format_plural($num_files, '1 attachment', '%count attachments'),
'href' => "node/$node->nid",
'attributes' => array('title' => t('Read full article to view attachments.')),
'fragment' => 'attachments'
);
}
}
......
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