By tstoeckler on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.0.x
Introduced in version:
8.0.0-beta1
Issue links:
Description:
In Drupal 7 (and in Drupal 8 previous to this change) the language direction constants had the following values:
// Drupal 7
LANGUAGE_LTR === 0;
LANGUAGE_RTL === 1;
// Drupal 8 before this change:
use Drupal\Core\Language\Language;
Language::DIRECTION_LTR === 0;
Language::DIRECTION_RTL === 1;
These values were not very intuitive, especially as they showed up in configuration exports.
Thus, these constants have now been changed to be self-explanatory strings 'ltr and 'rtl.
// Drupal 8 after this change:
use Drupal\Core\Language\Language;
Language::DIRECTION_LTR === 'ltr';
Language::DIRECTION_RTL === 'rtl';
This also means that these constants can be used directly for the lang HTML attribute:
// Drupal 7:
$render_array['#attributes'] = array(
'dir' => $language->dir == LANGUAGE_RTL ? 'rtl' : 'ltr',
);
// Drupal 8:
$render_array['#attributes'] = array(
'dir' => $language->getDirection(),
);
Note that this change affects active configuration.
Impacts:
Site builders, administrators, editors
Module developers
Themers