Commit 4cc09aaf authored by alexpott's avatar alexpott

Issue #1896060 by shanethehat, Cottser, joelpittet, disasm, ParisLiakos,...

Issue #1896060 by shanethehat, Cottser, joelpittet, disasm, ParisLiakos, Floydm, stevector, jenlampton, c4rl, mr.baileys, thedavidmeister, jwilson3: aggregator.module - Convert PHPTemplate templates to Twig.
parent dcfd4deb
......@@ -539,7 +539,7 @@ function aggregator_filter_xss($value) {
}
/**
* Implements hook_preprocess_HOOK() for block.tpl.php.
* Implements hook_preprocess_HOOK() for block.html.twig.
*/
function aggregator_preprocess_block(&$variables) {
if ($variables['configuration']['module'] == 'aggregator') {
......
......@@ -281,9 +281,14 @@ function theme_aggregator_summary_item($variables) {
}
/**
* Processes variables for aggregator-item.tpl.php.
* Prepares variables for aggregator item templates.
*
* @see aggregator-item.tpl.php
* Default template: aggregator-item.html.twig.
*
* @param array $variables
* An associative array containing:
* - aggregator_item: An individual feed item for display on the aggregator
* page.
*/
function template_preprocess_aggregator_item(&$variables) {
$item = $variables['aggregator_item'];
......@@ -309,6 +314,8 @@ function template_preprocess_aggregator_item(&$variables) {
foreach ($item->categories as $category) {
$variables['categories'][$category->cid] = l($category->title, 'aggregator/categories/' . $category->cid);
}
$variables['attributes']['class'][] = 'feed-item';
}
/**
......@@ -515,9 +522,15 @@ function theme_aggregator_page_opml($variables) {
}
/**
* Processes variables for aggregator-summary-items.tpl.php.
* Prepares variables for aggregator summary templates.
*
* @see aggregator-summary-items.tpl.php
* Default template: aggregator-summary-items.html.twig.
*
* @param array $variables
* An associative array containing:
* - source: A Drupal\aggregator\Plugin\Core\Entity\Feed instance representing
* the feed source.
* - summary_items: An array of feed items.
*/
function template_preprocess_aggregator_summary_items(&$variables) {
$variables['title'] = check_plain($variables['source'] instanceof EntityInterface ? $variables['source']->label() : $variables['source']->title);
......@@ -533,9 +546,14 @@ function template_preprocess_aggregator_summary_items(&$variables) {
}
/**
* Processes variables for aggregator-summary-item.tpl.php.
* Processes variables for aggregator summary item templates.
*
* @see aggregator-summary-item.tpl.php
* Default template: aggregator-summary-item.html.twig.
*
* @param array $variables
* An associative array containing:
* - aggregator_item: The feed item.
* - view_mode: How the item is being displayed.
*/
function template_preprocess_aggregator_summary_item(&$variables) {
$item = $variables['aggregator_item'];
......@@ -556,9 +574,14 @@ function template_preprocess_aggregator_summary_item(&$variables) {
}
/**
* Processes variables for aggregator-feed-source.tpl.php.
* Prepares variables for aggregator feed source templates.
*
* Default template: aggregator-feed-source.html.twig.
*
* @see aggregator-feed-source.tpl.php
* @param array $variables
* An associative array containing:
* - aggregator_feed: A Drupal\aggregator\Plugin\Core\Entity\Feed instance
* representing the feed source.
*/
function template_preprocess_aggregator_feed_source(&$variables) {
$feed = $variables['aggregator_feed'];
......@@ -584,4 +607,6 @@ function template_preprocess_aggregator_feed_source(&$variables) {
if (user_access('administer news feeds')) {
$variables['last_checked'] = l($variables['last_checked'], 'admin/config/services/aggregator');
}
$variables['attributes']['class'][] = 'feed-source';
}
<?php
{#
/**
* @file
* Default theme implementation to present the source of the feed.
......@@ -8,29 +7,29 @@
* For example, "example.com/aggregator/sources/1".
*
* Available variables:
* - $source_icon: Feed icon linked to the source. Rendered through
* theme_feed_icon().
* - $source_image: Image set by the feed source.
* - $source_description: Description set by the feed source.
* - $source_url: URL to the feed source.
* - $last_checked: How long ago the feed was checked locally.
* - source_icon: Feed icon linked to the source. Rendered through
* feed-icon.html.twig.
* - source_image: Image set by the feed source.
* - source_description: Description set by the feed source.
* - source_url: URL to the feed source.
* - last_checked: How long ago the feed was checked locally.
*
* @see template_preprocess()
* @see template_preprocess_aggregator_feed_source()
*
* @ingroup themeable
*/
?>
<div class="feed-source">
<?php print $source_icon; ?>
<?php print $source_image; ?>
#}
<div{{ attributes}}>
{{ source_icon }}
{{ source_image }}
<div class="feed-description">
<?php print $source_description; ?>
{{ source_description }}
</div>
<div class="feed-url">
<em><?php print t('URL:'); ?></em> <a href="<?php print $source_url; ?>"><?php print $source_url; ?></a>
<em>{{ 'URL'|t }}:</em> <a href="{{ source_url }}">{{ source_url }}</a>
</div>
<div class="feed-updated">
<em><?php print t('Updated:'); ?></em> <?php print $last_checked; ?>
<em>{{ 'Updated'|t }}:</em> {{ last_checked }}
</div>
</div>
{#
/**
* @file
* Default theme implementation to present a feed item in an aggregator page.
*
* Available variables:
* - feed_url: URL to the originating feed item.
* - feed_title: Title of the feed item.
* - source_url: Link to the local source section.
* - source_title: Title of the remote source.
* - source_date: Date the feed was posted on the remote source.
* - content: Feed item content.
* - categories: Linked categories assigned to the feed.
*
* @see template_preprocess()
* @see template_preprocess_aggregator_item()
*
* @ingroup themeable
*/
#}
<div{{ attributes }}>
<h3 class="feed-item-title">
<a href="{{ feed_url }}">{{ feed_title }}</a>
</h3>
<div class="feed-item-meta">
{% if source_url %}
<a href="{{ source_url }}" class="feed-item-source">{{ source_title }}</a> -
{% endif %}
<span class="feed-item-date">{{ source_date }}</span>
</div>
{% if content %}
<div class="feed-item-body">
{{ content }}
</div>
{% endif %}
{% if categories %}
<div class="feed-item-categories">
{{ 'Categories'|t }}: {{ categories|join(', ') }}
</div>
{% endif %}
</div>
<?php
/**
* @file
* Default theme implementation to format an individual feed item for display
* on the aggregator page.
*
* Available variables:
* - $feed_url: URL to the originating feed item.
* - $feed_title: Title of the feed item.
* - $source_url: Link to the local source section.
* - $source_title: Title of the remote source.
* - $source_date: Date the feed was posted on the remote source.
* - $content: Feed item content.
* - $categories: Linked categories assigned to the feed.
*
* @see template_preprocess()
* @see template_preprocess_aggregator_item()
*
* @ingroup themeable
*/
?>
<div class="feed-item">
<h3 class="feed-item-title">
<a href="<?php print $feed_url; ?>"><?php print $feed_title; ?></a>
</h3>
<div class="feed-item-meta">
<?php if ($source_url): ?>
<a href="<?php print $source_url; ?>" class="feed-item-source"><?php print $source_title; ?></a> -
<?php endif; ?>
<span class="feed-item-date"><?php print $source_date; ?></span>
</div>
<?php if ($content): ?>
<div class="feed-item-body">
<?php print $content; ?>
</div>
<?php endif; ?>
<?php if ($categories): ?>
<div class="feed-item-categories">
<?php print t('Categories'); ?>: <?php print implode(', ', $categories); ?>
</div>
<?php endif ;?>
</div>
<?php
{#
/**
* @file
* Default theme implementation to present feeds as list items.
......@@ -7,18 +6,19 @@
* Each iteration generates a single feed source or category.
*
* Available variables:
* - $title: Title of the feed or category.
* - $summary_list: Render array of unordered feed items list.
* - $source_url: URL to the local source or category.
* - title: Title of the feed or category.
* - summary_list: Unordered list of linked feed items generated through
* theme_item_list().
* - source_url: URL to the local source or category.
*
* @see template_preprocess()
* @see template_preprocess_aggregator_summary_items()
*
* @ingroup themeable
*/
?>
<h3><?php print $title; ?></h3>
<?php print render($summary_list); ?>
#}
<h3>{{ title }}</h3>
{{ summary_list }}
<div class="links">
<a href="<?php print $source_url; ?>"><?php print t("More<span class=\"element-invisible\"> posts about %title</span>", array('%title' => $title)); ?></a>
<a href="{{ source_url }}">{{ 'More<span class="element-invisible"> posts about %title</span>'|t({ '%title': title }) }}</a>
</div>
<?php
/**
* @file
* Default theme implementation to wrap aggregator content.
*
* Available variables:
* - $content: All aggregator content.
* - $page: Pager links rendered through theme_pager().
*
* @see template_preprocess()
* @see template_preprocess_aggregator_wrapper()
*
* @ingroup themeable
*/
?>
<div class="<?php print $attributes['class']; ?>">
<?php print $content; ?>
<?php print $pager; ?>
</div>
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