Commit f202b562 authored by alexpott's avatar alexpott

Issue #1843774 by joelpittet, chrisjlee, steveoliver, shanethehat: Convert...

Issue #1843774 by joelpittet, chrisjlee, steveoliver, shanethehat: Convert views/views_ui()/templates/views-ui-display-tab-setting.tpl.php to Twig.
parent 298d1fd0
{#
/**
* @file
* Default theme implementation for Views UI display tab settings.
*
* Template for each row inside the "boxes" on the display query edit screen.
*
* Available variables:
* - attributes: HTML attributes such as class for the container.
* - description: The description or label for this setting.
* - settings_links: A list of links for this setting.
*
* @see template_preprocess()
* @see template_preprocess_views_ui_display_tab_setting()
*
* @ingroup themeable
*/
#}
<div{{ attributes }}>
{% if description -%}
<span class="label">{{ description }}</span>
{%- endif %}
{% if settings_links %}
{{ settings_links|join('<span class="label">&nbsp;|&nbsp;</span>') }}
{% endif %}
</div>
<?php
/**
* @file
* Template for each row inside the "boxes" on the display query edit screen.
*/
?>
<div class="views-display-setting <?php print $attributes['class']; ?> <?php print $zebra; ?> clearfix" <?php print $attributes; ?>>
<?php if ($description): ?>
<span class="label"><?php print $description; ?></span>
<?php endif; ?>
<?php if ($settings_links): ?>
<?php print $settings_links; ?>
<?php endif; ?>
</div>
......@@ -15,14 +15,34 @@ function theme_views_ui_container($variables) {
return '<div' . new Attribute($element['#attributes']) . '>' . $element['#children'] . '</div>';
}
/**
* Prepares variables for Views UI display tab setting templates.
*
* Default template: views-ui-display-tab-setting.html.twig.
*
* @param array $variables
* An associative array containing:
* - link: The setting's primary link.
* - settings_links: An array of links for this setting.
* - defaulted: A boolean indicating the setting is in its default state.
* - overridden: A boolean indicating the setting has been overridden from
* the default.
* - description: The setting's description.
* - description_separator: A boolean indicating a separator colon should be
* appended to the setting's description.
*/
function template_preprocess_views_ui_display_tab_setting(&$variables) {
static $zebra = 0;
$variables['zebra'] = ($zebra % 2 === 0 ? 'odd' : 'even');
// Add default class attributes.
$variables['attributes']['class'][] = 'views-display-setting';
$variables['attributes']['class'][] = ($zebra % 2 === 0 ? 'odd' : 'even');
$variables['attributes']['class'][] = 'clearfix';
$zebra++;
// Put the main link to the left side
// Put the primary link to the left side.
array_unshift($variables['settings_links'], $variables['link']);
$variables['settings_links'] = implode('<span class="label">&nbsp;|&nbsp;</span>', $variables['settings_links']);
$variables['attributes']['class'][] = 'views-ui-display-tab-setting';
......@@ -31,7 +51,7 @@ function template_preprocess_views_ui_display_tab_setting(&$variables) {
}
if (!empty($variables['overridden'])) {
$variables['attributes']['class'][] = 'overridden';
$variables['attributes_array']['title'][] = t('Overridden');
$variables['attributes']['title'][] = t('Overridden');
}
// Append a colon to the description, if requested.
......
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