Commit fb4e8cdf authored by alexpott's avatar alexpott

Issue #2329847 by tuutti, rachel_norfolk, Cottser | davidhernandez: Use...

Issue #2329847 by tuutti, rachel_norfolk, Cottser | davidhernandez: Use Attribute to replace hard coded classes in language-negotiation-configure-form.html.twig.
parent 4d82422e
......@@ -7,6 +7,7 @@
use Drupal\Component\Utility\String;
use Drupal\Core\Render\Element;
use Drupal\Core\Template\Attribute;
/**
* Prepares variables for language negotiation configuration form.
......@@ -84,6 +85,7 @@ function template_preprocess_language_negotiation_configure_form(&$variables) {
'configurable' => $configurable,
'table' => $table,
'children' => $form[$type],
'attributes' => new Attribute(),
);
// Prevent the type from rendering with the remaining form child elements.
unset($form[$type]);
......
......@@ -12,6 +12,7 @@
* - configurable: A radio element to toggle the table.
* - table: A draggable table for the language detection methods of this type.
* - children: Remaining form items for the group.
* - attributes: A list of HTML attributes for the wrapper element.
* - children: Remaining form items for all groups.
*
* @see template_preprocess_language_negotiation_configure_form()
......@@ -20,7 +21,14 @@
*/
#}
{% for language_type in language_types %}
<div class="form-item table-language-group table-{{ language_type.type }}-wrapper">
{%
set language_classes = [
'form-item',
'table-language-group',
'table-' ~ language_type.type ~ '-wrapper',
]
%}
<div{{ language_type.attributes.addClass(language_classes) }}>
<h2>{{ language_type.title }}</h2>
<div class="description">{{ language_type.description }}</div>
{{ language_type.configurable }}
......
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