Chongqing, China
Account created on 10 June 2014, over 10 years ago
#

Merge Requests

More

Recent comments

🇨🇳China jungle Chongqing, China

10.3 was out

🇨🇳China jungle Chongqing, China

Per @krystalcode's comment in #54, I introduced a utility method to replace the current usages of unserialize() in SqlContentEntityStorage

+  /**
+   * Safely unserializes data.
+   *
+   * @param string|null $value
+   *   The serialized string.
+   *
+   * @return mixed|null
+   *   The unserialized data, or null if the data is invalid.
+   */
+  public static function safeUnserialize($value) {
+    // Return null if the value is an empty string or null.
+    if ($value === '' || $value === null) {
+      return null;
+    }
+
+    // Attempt to unserialize the value.
+    $result = @unserialize($value);
+
+    // Check if unserialize resulted in false, indicating failure.
+    // Also ensure the input value wasn't the serialized form of false itself.
+    if ($result === false && $value !== serialize(false)) {
+      return null;
+    }
+
+    // Return the unserialized result.
+    return $result;
+  }
+

NW for adding tests.

🇨🇳China jungle Chongqing, China

Re #5, with the upgrade_status module for this case.

Thank you, @goodboy!

🇨🇳China jungle Chongqing, China

jungle made their first commit to this issue’s fork.

🇨🇳China jungle Chongqing, China

Committed, thanks!

🇨🇳China jungle Chongqing, China

This is a duplicate if the approach I proposed in 🐛 Compability issue with BEF 8.x-5.0 and BEF 6.0.3 RTBC is accepted

See https://www.drupal.org/project/vefl/issues/3161777#comment-15564072 🐛 Compability issue with BEF 8.x-5.0 and BEF 6.0.3 RTBC

🇨🇳China jungle Chongqing, China

Every time the BEF module changes the signature of __construct(), this module breaks. So I would suggest keeping __construct() untouched. And inject the vefl.layout service in create(), see the code snippet below, with this approach, 🐛 Compability issue with BEF 6.0.3 Needs review is a duplicate to me.

  /**
   * The vefl layout helper.
   *
   * @var \Drupal\vefl\Vefl
   */
  protected $vefl;

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
    $instance = parent::create($container, $configuration, $plugin_id, $plugin_definition);
    $instance->vefl = $container->get('vefl.layout');
    return $instance;
  }
🇨🇳China jungle Chongqing, China

jungle changed the visibility of the branch btriest-3439957-requirement-variation-cache-patch-40e4 to active.

🇨🇳China jungle Chongqing, China

jungle changed the visibility of the branch btriest-3439957-requirement-variation-cache-patch-40e4 to hidden.

🇨🇳China jungle Chongqing, China

@sokru: Doesn’t https://github.com/symfony/string/blob/6.2/Slugger/AsciiSlugger.php#L19-L21 mean we’d also need symfony/translation-contracts as direct dependency?

@sokru pointed out in slack symfony/translation-contracts should be added as a direct dependency as well,

🇨🇳China jungle Chongqing, China

Removing myself from draft credit

🇨🇳China jungle Chongqing, China

What's the future plan here?

  1. TrustedCallbackInterface co-exists with the TrustedCallback attribute forever?
  2. Or deprecate the TrustedCallbackInterface, and go for the TrustedCallback attribute completely?

If it's option #2, should we deprecate the TrustedCallbackInterface here?

🇨🇳China jungle Chongqing, China

To me, It's ready. @TR, thank you!

🇨🇳China jungle Chongqing, China

Update the description of Transliterate to mention the use of the replacement character.

🇨🇳China jungle Chongqing, China

@sokru: Personally I’d prefer option-1.png (first one), since “Transliterate” also uses replacement character.

Adjust the position of the Replacement character form element.

🇨🇳China jungle Chongqing, China

There are failed tests to be fixed, suppressed temporarily in the .gitlab-ci.yml file with allow_failure: true

🇨🇳China jungle Chongqing, China
+++ b/core/modules/file/file.module
@@ -1377,8 +1377,9 @@ function file_form_system_file_system_settings_alter(array &$form, FormStateInte
+    '#description' => t('For example, "a _ file ._--_. name.txt" changes to "a _ file - name.txt".'),

After reading the discussion in slack, which @dww pointed me to (thanks!), I am removing the #description. And let's do it in the follow-up with the javascript approach to make the example dynamic depending on the selected replacement character.

One suggestion from me is to move the Replacement character form element to the top before deduplicate_separators , because in the label of deduplicate_separators, which mentioned replacement character, if the end users see the term Replacement character first which would make more sense.

Tagging "Needs followup"

🇨🇳China jungle Chongqing, China

Addressing #43. RTBC, unless the CI rejects. The current dev branch is 10.1.x

🇨🇳China jungle Chongqing, China
+++ b/core/modules/file/file.module
@@ -1332,3 +1332,81 @@ function file_get_file_references(FileInterface $file, FieldDefinitionInterface
+ * These settings are enforced during upload by the FileEventSubscriber that
+ * listens to the FileUploadEvent::UPLOAD event.

The FileUploadEvent class does not exist. Updating the comment.

🇨🇳China jungle Chongqing, China
+++ b/core/modules/file/config/schema/file.schema.yml
@@ -24,6 +24,28 @@ file.settings:
+          label: 'replace sequences of dots, underscores and/or dashes with the replacement character'

Oops, "replace" should be uppercased.

1. Emojis are everywhere, and I'd like to have the option to transliterate them, as I commented in #337, but with the FileUploadSanitizeNameEvent added, it's easy to do in custom code.

Event subscribers can modify and sanitize the filename (but not extension) before the file is saved.

2. Meanwhile, I saw extension is not available for altering. Is there a good reason for that? I have not found it with a quick look.

🇨🇳China jungle Chongqing, China

MR !3582 added a new filter plugin and intended to deprecate the filter plugin taxonomy_index_tid, because there are usages of taxonomy_index_tid in contrib modules pointed by @Lendude in #242.1.

function taxonomy_field_views_data_alter(array &$data, FieldStorageConfigInterface $field_storage) {
  if ($field_storage->getType() == 'entity_reference' && $field_storage->getSetting('target_type') == 'taxonomy_term') {
    foreach ($data as $table_name => $table_data) {
      foreach ($table_data as $field_name => $field_data) {
        if (isset($field_data['filter']) && $field_name != 'delta') {
          $data[$table_name][$field_name]['filter']['id'] = 'taxonomy_index_tid';
        }
      }
    }
  }
}

BUT we can only have one filter in use. The two filters can't coexist well. See the code above in taxonomy.views.inc

So, MR !3681 was opened, which added the vids key to the schema but kept the vid key as deprecated.

All points from #242 were addressed in MR !3681

CR updated

MR !3681 is ready for review.

🇨🇳China jungle Chongqing, China

To me, the documentation of DrupalCI customization is for Core development mainly. Rescope this, and hope that CS violations can be detected via Gitlab CI

Requested access to Gitlab CI #3261803: Using GitLab CI instead of Drupal CI

🇨🇳China jungle Chongqing, China
  input.html.twig
  input--textfield.html.twig
1. `input.html.twig`
2. `input--textfield.html.twig`

Formdazzle adds the following two theme suggestions to the list:

  input--textfield--webform-contact.html.twig
  input--textfield--webform-contact--first-name.html.twig
3. `input--textfield--webform-contact.html.twig`
4. `input--textfield--webform-contact--first-name.html.twig`
Ordered lists use "1", for easier updates and to avoid errors (see Configuration)

Actually, using “1”s is the best practice for ordered lists. see here -- on the same page of the link in IS.

Sorry, @JohnAlbin, I didn't know that when reviewing this one till last week while working on 📌 Update README formatting Fixed .

🇨🇳China jungle Chongqing, China
  1. Re #241, per a quick manual testing made yesterday, the vid key was still there after running the database update.. #242.1 may be relevant.
  2. +++ b/core/modules/taxonomy/taxonomy.post_update.php
    --- a/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_filter_taxonomy_index_tid.yml
    +++ b/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_filter_taxonomy_index_tid.yml
    

    Meanwhile, found that the view exported is outdated. Maybe a follow-up to update them as they were not introduced by this issue -- out of scope here.

  3. diff --git a/core/modules/taxonomy/config/schema/taxonomy.views.schema.yml b/core/modules/taxonomy/config/schema/taxonomy.views.schema.yml
    index 9ec9758185..398b7a130b 100644
    --- a/core/modules/taxonomy/config/schema/taxonomy.views.schema.yml
    +++ b/core/modules/taxonomy/config/schema/taxonomy.views.schema.yml
    @@ -116,9 +116,36 @@ views.field.taxonomy_index_tid:
             type: string
             label: 'Vocabulary'
     
    +views.filter.taxonomy_index_tid_vids:
    +  type: views.filter.many_to_one
    +  label: 'Taxonomy term ID'
    +  mapping:
    +    vid:
    +      type: string
    +      label: 'Vocabulary'
    +    type:
    +      type: string
    +      label: 'Selection type'
    +    hierarchy:
    +      type: boolean
    +      label: 'Show hierarchy in dropdown'
    +    limit:
    +      type: boolean
    +      label: 'Limit to vocabulary'
    +    error_message:
    +      type: boolean
    +      label: 'Display error message'
    +    value:
    +      type: sequence
    +      label: 'Values'
    +      sequence:
    +        type: integer
    +        label: 'Value'
    +
     views.filter.taxonomy_index_tid:
       type: views.filter.many_to_one
       label: 'Taxonomy term ID'
    +  deprecated: "The 'views.filter.taxonomy_index_tid' config schema is deprecated in drupal:10.0.0 and is removed from drupal:11.0.0. Use the 'views.filter.taxonomy_index_tid_vids' config schema instead. See https://www.drupal.org/node/3162414."
       mapping:
         vid:
           type: string
    

    Can we agree on #242.1 to add a new plugin, e.g. name it taxonomy_index_tid_vids with the new schema above and continue?

Thanks, @Lendude for your review.

🇨🇳China jungle Chongqing, China

There are more discussions continued with the above on slack, for the full messages in the thread, please view it here,

The summary we agreed on:

  • Continue with extracting a README.md from the .module file to avoid credits gaming, do it in one go, or do it with 3-5 submodules per batch.
  • To have an example of help_topics: help_topics_example, Add help_topics example Active , postpone the implementation or integration of help_topics into examples.
  • Allow to accept translations of README.md, but optional, for the syncing. If the translation is outdated, give it a time window, e.g. one or two weeks to update or it gets removed.

Thanks @valthebald and @andypost

🇨🇳China jungle Chongqing, China

> valthebald: for README.md, will this be compatible with core's help_topics module?
> valthebald: it would be great to do so
> valthebald @jungle ^
> jungle: Hi, @valthebald no plan from me for that, to me, personally, it’s optional, README.md is enough for me as a dev. it’s an Experimental module in Drupal 9, I do not think it’s widely adopted by contrib modules, — just guess.
>jungle: even implementing hook_help is optional to me.

Chatting messages from slack.

🇨🇳China jungle Chongqing, China

+1 to #11

Check core/modules/file/src/FileAccessControlHandler.php, and see the source code here, I think this is a won't fix

🇨🇳China jungle Chongqing, China

FYI, Wrapped each line in less than 80 chars, and changed reenable to re-enable

🇨🇳China jungle Chongqing, China
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxMaintenanceModeTest.php
@@ -0,0 +1,96 @@
+class AjaxMaintenanceModeTest extends WebDriverTestBase {

Agree with @alexpott in #40,and the test could be simplified by using ajax_test, ajax_form_test.

🇨🇳China jungle Chongqing, China

Apply the issue summary(IS) template only. If #55 is a thing, then needs updating IS.

🇨🇳China jungle Chongqing, China

Not a bug, could be a Minor

🇨🇳China jungle Chongqing, China
<?php

namespace Drupal\Core;

/**
 * This class holds a <span> generated from the <nolink> route.
 */
class GeneratedNoLink extends GeneratedLink {

  /**
   * {@inheritdoc}
   */
  const TAG = 'span';

}

<nolink> is a special route too, which is not documented by the patch here, is it irrelevant here?

🇨🇳China jungle Chongqing, China

The root is each submodule in my suggestion.

- js_example/README.md
- js_example/README.translations/zh-hans/README.md
- js_example/README.translations/es/README.md
- js_example/README.translations/fr/README.md
- ...

> What would be the benefits of having the translations in individual folders?

Let's see what others say :)

🇨🇳China jungle Chongqing, China
- README.md
- README-translations/zh-hans/README.md
- README-translations/es/README.md
- README-translations/fr/README.md
- ...

Suggested file pathes are the above. Or another variation: replace README-translations with README.translations

- README.md
- README.translations/zh-hans/README.md
- README.translations/es/README.md
- README.translations/fr/README.md
- ...
🇨🇳China jungle Chongqing, China

@ressa, I did send this issue to #examples-module and #documentaion in Drupal slack, hopefully, We can get agreement or feedback from them, and I would suggest holding on for a day or two, at least, before taking any further contributions. As I am not the only maintainer of this project, others may have different opinions. This is a kind of broken change. -- content of this module on api.drupal.org gets affected.

Many thanks!

🇨🇳China jungle Chongqing, China

Also, are you able to create a "Documentation" option under "Component" for issues?

Added

README.md // English by default
translations
- README.chinese-zh-hans.md
- README.spanish.md
- README.french.md
...

The structure works, but I still think the following is better.

README.md // English by default
README-translations // A directory indicates that there are README translations inside and ONLY!
    zh-hans // Using language code is fine, I think.
        README.md // Chinese translation, Entering this zh-hans, this is the only file, and Gitlab recognizes it automatically
    es // Spanish
        README.md // Spanish translation
    ...
🇨🇳China jungle Chongqing, China

Or replace the folder name README with README_translations in the suggested file structure.

🇨🇳China jungle Chongqing, China

Meanwhile, I am considering using ChatGPT to help and translate the READ.md file into other languages. It can lower the barrier more or less for learning from the examples module.

The file structure would be

README.md // English by default
README
   - zh-hans/README.md // Chinese,
   - es/README.md // Spanish
   - fr/README.md // French
   ... 

All README.md files will be parsed/rendered automatically on GitLab as well. And each transition should be reviewed by a native before gets committed.

🇨🇳China jungle Chongqing, China

Meanwhile, we are using GitLab more and more, it parses README.md automatically. Let's do it.

🇨🇳China jungle Chongqing, China

So, as an example, would it mean deleting this part from the js_example.module:

Go ahead please with the suggestion in #5 if you like, thanks!

🇨🇳China jungle Chongqing, China

I copied and pasted the content of file_example.module file into chatgpt, and asked it to do it for me, it works well to me.

See the commit here

The sample instruction i used, FYI

Extract a REAME.md file from the content following, wrap it in less than 80 chars for each line of the answer and give me the answer in a markdown code block.

THE CONTENT OF THE MODULE FILE

🇨🇳China jungle Chongqing, China
+++ b/README.md
@@ -48,14 +48,14 @@ about how to use Composer with Drupal on
 

@ressa, I meant to append a note at the button of the README.md if you agree, e.g.:

Note: In this file, `1.`'s are used for the ordered list, which is a "best practice" (see [README.md template
]( https://www.drupal.org/docs/develop/managing-a-drupalorg-theme-module-or... )

)

🇨🇳China jungle Chongqing, China

1) Drupal\Tests\ckeditor5\FunctionalJavascript\MediaTest::testLinkManualDecorator with data set "restricted" (false)

Behat\Mink\Exception\ElementNotFoundException: Element matching css ".ck-balloon-panel_visible .ck-balloon-rotator__content > .ck.ck-link-actions" not found.

It seems irrelevant. Queued another test.

🇨🇳China jungle Chongqing, China

Thanks @Lendude. Let's see how it goes.

+++ b/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyIndexTidUiTest.php
@@ -144,6 +165,80 @@ public function testFilterUI() {
+   * Test filter UI with multiple vocabularies.

Should start with "Tests", changing it to "Tests the filter UI with multiple vocabularies.", Keep RTBC.

Production build 0.71.5 2024