Commit 8f7dc88d authored by alexpott's avatar alexpott

Issue #1898460 by pixelmord, bstoppel, steveoliver, jenlampton, johnnygamba,...

Issue #1898460 by pixelmord, bstoppel, steveoliver, jenlampton, johnnygamba, jastraat, Cottser, lbainbridge, myke, thedavidmeister, c4rl, joelpittet, ezeedub: Convert taxonomy module to Twig.
parent b171982f
......@@ -452,7 +452,18 @@ function taxonomy_term_view_multiple(array $terms, $view_mode = 'full', $langcod
}
/**
* Process variables for taxonomy-term.tpl.php.
* Prepares variables for taxonomy term templates.
*
* Default template: taxonomy-term.html.twig.
*
* @param array $variables
* An associative array containing:
* - elements: An associative array containing the taxonomy term and any
* fields attached to the term. Properties used:
* - #term: The term object.
* - #view_mode: The current view mode for this taxonomy term, e.g.
* 'full' or 'teaser'.
* - attributes: HTML attributes for the containing element.
*/
function template_preprocess_taxonomy_term(&$variables) {
$variables['view_mode'] = $variables['elements']['#view_mode'];
......@@ -461,8 +472,9 @@ function template_preprocess_taxonomy_term(&$variables) {
$uri = $term->uri();
$variables['url'] = url($uri['path'], $uri['options']);
$variables['label'] = check_plain($term->label());
$variables['page'] = $variables['view_mode'] == 'full' && taxonomy_term_is_page($term);
// We use name here because that is what appears in the UI.
$variables['name'] = check_plain($term->label());
$variables['page'] = $variables['view_mode'] == 'full' && taxonomy_term_is_page($term);
// Helpful $content variable for templates.
$variables['content'] = array();
......
{#
/**
* @file
* Default theme implementation to display a taxonomy term.
*
* Available variables:
* - url: URL of the current term.
* - name: Name of the current term.
* - content: Items for the content of the term (fields and description).
* Use 'content' to print them all, or print a subset such as
* 'content.description'. Use the following code to temporarily suppress the
* printing of a given element:
* @code
* {% hide(content.description) %}
* @endcode
* - attributes: HTML attributes for the wrapper. The 'class' attribute
* contains the following classes by default:
* - taxonomy-term: The current template type, i.e. "theming hook".
* - vocabulary-[vocabulary-name]: The vocabulary that this term belongs to.
* For example, if the term belongs to a vocabulary called "Tags" then the
* class would be "vocabulary-tags".
* - page: Flag for the full page state.
* - term: The taxonomy term entity, including:
* - id: The ID of the taxonomy term.
* - view_mode: View mode, e.g. 'full', 'teaser', etc.
*
* @see template_preprocess()
* @see template_preprocess_taxonomy_term()
*
* @ingroup themeable
*/
#}
<div id="taxonomy-term-{{ term.id }}"{{ attributes }}>
{{ title_prefix }}
{% if not page %}
<h2><a href="{{ url }}">{{ name }}</a></h2>
{% endif %}
{{ title_suffix }}
<div class="content">
{{ content }}
</div>
</div>
<?php
/**
* @file
* Default theme implementation to display a term.
*
* Available variables:
* - $content: An array of items for the content of the term (fields and
* description). Use render($content) to print them all, or print a subset
* such as render($content['field_example']). Use
* hide($content['field_example']) to temporarily suppress the printing of a
* given element.
* - $url: Direct url of the current term.
* - $label: Name of the current term.
* - $attributes: An instance of Attributes class that can be manipulated as an
* array and printed as a string.
* It includes the 'class' information, which includes:
* - taxonomy-term: The current template type, i.e., "theming hook".
* - vocabulary-[vocabulary-name]: The vocabulary to which the term belongs to.
* For example, if the term is a "Tag" it would result in "vocabulary-tag".
*
* Other variables:
* - $term: Full term object. Contains data that may not be safe.
* - $view_mode: View mode, e.g. 'full', 'teaser'...
* - $page: Flag for the full page state.
* - $is_front: Flags true when presented in the front page.
* - $logged_in: Flags true when the current user is a logged-in member.
* - $is_admin: Flags true when the current user is an administrator.
*
* @see template_preprocess()
* @see template_preprocess_taxonomy_term()
* @see template_process()
*
* @ingroup themeable
*/
?>
<div id="taxonomy-term-<?php print $term->id(); ?>"<?php print $attributes; ?>>
<?php print render($title_prefix); ?>
<?php if (!$page): ?>
<h2><a href="<?php print $url; ?>"><?php print $label; ?></a></h2>
<?php endif; ?>
<?php print render($title_suffix); ?>
<div class="content">
<?php print render($content); ?>
</div>
</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