Commit 58c54c35 authored by alexpott's avatar alexpott

Issue #2008970 by markie, adamcowboy: Replace theme() with drupal_render() in aggregator module.

parent d91dc913
......@@ -376,7 +376,12 @@ function aggregator_page_rss() {
}
$feeds = $result->fetchAll();
return theme('aggregator_page_rss', array('feeds' => $feeds, 'category' => $category));
$aggregator_page_rss = array(
'#theme' => 'aggregator_page_rss',
'#feeds' => $feeds,
'#category' => $category,
);
return drupal_render($aggregator_page_rss);
}
/**
......@@ -448,7 +453,11 @@ function aggregator_page_opml($cid = NULL) {
}
$feeds = $result->fetchAll();
return theme('aggregator_page_opml', array('feeds' => $feeds));
$aggregator_page_opml = array(
'#theme' => 'aggregator_page_opml',
'#feeds' => $feeds,
);
return drupal_render($aggregator_page_opml);
}
/**
......@@ -523,14 +532,16 @@ function template_preprocess_aggregator_summary_item(&$variables) {
'class' => array('feed-item-url',),
),
));
$variables['item_age'] = theme('datetime', array(
'attributes' => array(
$datetime = array(
'#theme' => 'datetime',
'#attributes' => array(
'datetime' => format_date($item->timestamp->value, 'html_datetime', '', 'UTC'),
'class' => array('feed-item-age',),
),
'text' => t('%age old', array('%age' => format_interval(REQUEST_TIME - $item->timestamp->value))),
'html' => TRUE,
));
'#text' => t('%age old', array('%age' => format_interval(REQUEST_TIME - $item->timestamp->value))),
'#html' => TRUE,
);
$variables['item_age'] = drupal_render($datetime);
}
/**
......@@ -546,10 +557,20 @@ function template_preprocess_aggregator_summary_item(&$variables) {
function template_preprocess_aggregator_feed_source(&$variables) {
$feed = $variables['aggregator_feed'];
$variables['source_icon'] = theme('feed_icon', array('url' => $feed->url->value, 'title' => t('!title feed', array('!title' => $feed->label()))));
$feed_icon = array(
'#theme' => 'feed_icon',
'#url' => $feed->url->value,
'#title' => t('!title feed', array('!title' => $feed->label())),
);
$variables['source_icon'] = drupal_render($feed_icon);
if (!empty($feed->image->value) && $feed->label() && !empty($feed->link->value)) {
$variables['source_image'] = l(theme('image', array('path' => $feed->image->value, 'alt' => $feed->title->value)), $feed->link->value, array('html' => TRUE, 'attributes' => array('class' => 'feed-image')));
$image = array(
'#theme' => 'image',
'#path' => $feed->image->value,
'#alt' => $feed->title->value,
);
$variables['source_image'] = l($image, $feed->link->value, array('html' => TRUE, 'attributes' => array('class' => 'feed-image')));
}
else {
$variables['source_image'] = '';
......
......@@ -68,17 +68,30 @@ public function build() {
$id = $this->getPluginId();
if ($category = db_query('SELECT cid, title, block FROM {aggregator_category} WHERE cid = :cid', array(':cid' => $id))->fetchObject()) {
$result = db_query_range('SELECT i.* FROM {aggregator_category_item} ci LEFT JOIN {aggregator_item} i ON ci.iid = i.iid WHERE ci.cid = :cid ORDER BY i.timestamp DESC, i.iid DESC', 0, $this->configuration['block_count'], array(':cid' => $category->cid));
$read_more = theme('more_link', array('url' => 'aggregator/categories/' . $category->cid, 'title' => t("View this category's recent news.")));
$more_link = array(
'#theme' => 'more_link',
'#url' => 'aggregator/categories/' . $category->cid,
'#title' => t("View this category's recent news."),
);
$read_more = drupal_render($more_link);
$items = array();
foreach ($result as $item) {
$items[] = theme('aggregator_block_item', array('item' => $item));
$aggregator_block_item = array(
'#theme' => 'aggregator_block_item',
'#item' => $item,
);
$items[] = drupal_render($aggregator_block_item);
}
// Only display the block if there are items to show.
if (count($items) > 0) {
$item_list = array(
'#theme' => 'item_list',
'#items' => $items,
);
return array(
'#children' => theme('item_list', array('items' => $items)) . $read_more,
'#children' => drupal_render($item_list) . $read_more,
);
}
return array();
......
......@@ -69,16 +69,28 @@ public function build() {
list(, $id) = explode(':', $this->getPluginId());
if ($feed = db_query('SELECT fid, title, block FROM {aggregator_feed} WHERE block <> 0 AND fid = :fid', array(':fid' => $id))->fetchObject()) {
$result = db_query_range("SELECT * FROM {aggregator_item} WHERE fid = :fid ORDER BY timestamp DESC, iid DESC", 0, $this->configuration['block_count'], array(':fid' => $id));
$read_more = theme('more_link', array('url' => 'aggregator/sources/' . $feed->fid, 'title' => t("View this feed's recent news.")));
$more_link = array(
'#theme' => 'more_link',
'#url' => 'aggregator/sources/' . $feed->fid,
'#title' => t("View this feed's recent news."),
);
$read_more = drupal_render($more_link);
$items = array();
foreach ($result as $item) {
$items[] = theme('aggregator_block_item', array('item' => $item));
$aggregator_block_item = array(
'#theme' => 'aggregator_block_item',
'#item' => $item,
);
$items[] = drupal_render($aggregator_block_item);
}
// Only display the block if there are items to show.
if (count($items) > 0) {
$item_list = array(
'#theme' => 'item_list',
'#items' => $items,
);
return array(
'#children' => theme('item_list', array('items' => $items)) . $read_more,
'#children' => drupal_render($item_list) . $read_more,
);
}
}
......
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