diff --git a/core/modules/aggregator/aggregator.module b/core/modules/aggregator/aggregator.module index d2c07af..be11fea 100644 --- a/core/modules/aggregator/aggregator.module +++ b/core/modules/aggregator/aggregator.module @@ -59,6 +59,7 @@ function aggregator_theme() { ), 'aggregator_block_item' => array( 'variables' => array('item' => NULL, 'feed' => 0), + 'template' => 'aggregator-block-item', ), 'aggregator_summary_items' => array( 'variables' => array('summary_items' => NULL, 'source' => NULL), @@ -68,6 +69,7 @@ function aggregator_theme() { 'aggregator_summary_item' => array( 'variables' => array('aggregator_item' => NULL, 'view_mode' => NULL), 'file' => 'aggregator.pages.inc', + 'template' => 'aggregator-summary-item', ), 'aggregator_item' => array( 'variables' => array('aggregator_item' => NULL, 'view_mode' => NULL), @@ -488,18 +490,19 @@ function aggregator_category_load($cid) { } /** - * Returns HTML for an individual feed item for display in the block. + * Prepares variables for individual feed item block templates. * - * @param $variables + * Default template: aggregator-block-item.html.twig. + * + * @param array $variables * An associative array containing: * - item: The item to be displayed. * - feed: Not used. - * - * @ingroup themeable */ -function theme_aggregator_block_item($variables) { +function template_preprocess_aggregator_block_item(&$variables) { // Display the external link to the item. - return '' . check_plain($variables['item']->title) . "\n"; + $variables['url'] = check_url($variables['item']->link); + $variables['title'] = check_plain($variables['item']->title); } /** diff --git a/core/modules/aggregator/aggregator.pages.inc b/core/modules/aggregator/aggregator.pages.inc index b6d4062..0ac07f1 100644 --- a/core/modules/aggregator/aggregator.pages.inc +++ b/core/modules/aggregator/aggregator.pages.inc @@ -7,6 +7,7 @@ use Drupal\aggregator\Plugin\Core\Entity\Feed; use Drupal\Core\Entity\EntityInterface; +use Drupal\Core\Language\Language; /** * Page callback: Displays all the items captured from the particular feed. @@ -266,21 +267,6 @@ function aggregator_categorize_items_submit($form, &$form_state) { } /** - * Default theme implementation to present a linked feed item for summaries. - * - * @param $variables - * An associative array containing: - * - item_link: Link to item. - * - item_age: Age of the item. - * - * @see template_preprocess() - * @see template_preprocess_aggregator_summary_item() - */ -function theme_aggregator_summary_item($variables) { - return $variables['item_url'] . ' ' . $variables['item_age']; -} - -/** * Prepares variables for aggregator item templates. * * Default template: aggregator-item.html.twig. diff --git a/core/modules/aggregator/templates/aggregator-block-item.html.twig b/core/modules/aggregator/templates/aggregator-block-item.html.twig new file mode 100644 index 0000000..10bc490 --- /dev/null +++ b/core/modules/aggregator/templates/aggregator-block-item.html.twig @@ -0,0 +1,16 @@ +{# +/** + * @file + * Default theme implementation for feed item for display in the block. + * + * Available variables: + * - url: URL to the feed item. + * - title: Title of the feed item. + * + * @see template_preprocess() + * @see template_preprocess_aggregator_block_item() + * + * @ingroup themeable + */ +#} +{{ title }} diff --git a/core/modules/aggregator/templates/aggregator-summary-item.html.twig b/core/modules/aggregator/templates/aggregator-summary-item.html.twig new file mode 100644 index 0000000..6e2d8b1 --- /dev/null +++ b/core/modules/aggregator/templates/aggregator-summary-item.html.twig @@ -0,0 +1,16 @@ +{# +/** + * @file + * Default theme implementation for a single feed in a list of feed items. + * + * Available variables: + * - link: Link to item. + * - age: Age of the item. + * + * @see template_preprocess() + * @see template_preprocess_aggregator_summary_item() + * + * @ingroup themeable + */ +#} +{{ url }} {{ age }}