Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Apply coding standards and best practices
Comment | File | Size | Author |
---|---|---|---|
#14 | languagefield-apply_coding_standards-3036979-14.patch | 35.21 KB | lamp5 |
#2 | coding-standarts-3036979-2.patch | 3.98 KB | echo15 |
Comments
Comment #2
echo15 CreditAttribution: echo15 at EPAM Systems commentedProviding patch.
Comment #3
echo15 CreditAttribution: echo15 at EPAM Systems commentedComment #4
nikolas.tatianenko CreditAttribution: nikolas.tatianenko at EPAM Systems commentedComment #5
sosevich.v CreditAttribution: sosevich.v at EPAM Systems commentedAfter the patch #2 module still needs work on the following files (checked with Drupal and DrupalPractice standards):
/languagefield.info.yml
/src/Controller/LanguageAutocompleteController.php
/src/CustomLanguageListBuilder.php
/src/Entity/CustomLanguage.php
/src/Entity/CustomLanguageInterface.php
/src/Entity/CustomLanguageManager.php
/src/Form/CustomLanguageForm.php
/src/Plugin/Field/FieldFormatter/LanguageFormatter.php
/src/Plugin/Field/FieldType/LanguageItem.php
/src/Plugin/Field/FieldWidget/LanguageAutocompleteWidget.php
/src/Plugin/Field/FieldWidget/LanguageSelectWidget.php
/src/Plugin/views/filter/LanguageFilter.php
This is true for the module:
version: '8.x-1.4'
core: '8.x'
Comment #6
echo15 CreditAttribution: echo15 at EPAM Systems commented@sosevich.v this issue can stay opened for future codestyle updates
Comment #7
echo15 CreditAttribution: echo15 at EPAM Systems commentedComment #8
sosevich.v CreditAttribution: sosevich.v at EPAM Systems commentedOk, I see. In that case the patch fixed given files according to coding standards.
For further improvements see comment #5.
Comment #10
johnvCommitted. Thanks. Back to active for more files.
Comment #11
phjouComment #12
phjouSorry wrong edit.
Comment #14
lamp5Comment #16
johnvCommitted, thanks.
Only the following parts have not been changed, since it changes behaviour without justification:
Comment #17
lamp5Translating Variables
You should never use t() to translate variables, such as calling
t($text);
, unless the text that the variable holds has been passed through t() elsewhere (e.g., $text is one of several translated literal strings in an array). It is especially important never to call
t($user_text);
, where $user_text is some text that a user entered - doing that can lead to cross-site scripting and other security problems. However, you can use variable substitution in your string, to put variable text such as user names or link URLs into translated text. Variable substitution looks like this:
@from https://api.drupal.org/api/drupal/includes%21bootstrap.inc/function/t/7.x
Comment #19
nagy.balint CreditAttribution: nagy.balint at Agence Inovae commentedHi!
The following change in getLanguageConfigurationValues caused an issue:
- $value = $code;
+ $value = LanguageInterface::LANGCODE_NOT_SPECIFIED;
Its fixed at #3125977: Widget 'Language select list' does not save selected value