Doublecheck settings being merged

Created on 3 July 2025, about 1 month ago

Relocated from #3531327-5: Create new "power user" flag to disable warnings and validation :

public function settingsForm(array $form, FormStateInterface $form_state): array {
    $this->settings = array_replace_recursive($this->defaultSettings(), $this->settings);

The fact that defaultSettings() are only merged in settingsForm(), and not in the constructor or process(), feels off. That said, it might be 100% valid. I'm thinking that if the filter ever processes text without the form being loaded first, it could result in unexpected behavior? I wonder if it makes more sense to initialize $this->settings in the constructor.

📌 Task
Status

Active

Version

2.0

Component

Code

Created by

🇺🇸United States ultimike Florida, USA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @ultimike
  • 🇺🇸United States ultimike Florida, USA

    I dug into this one a bit and I don't think that line is actually necessary.

    It was added early on in 📌 Support additional extensions Active , but was never removed as the MR evolved.

    I also removed a default setting for the "tips" form element, which is just static text.

    Additionally, I searched in core and a bunch of contrib modules for a something similar and found nothing. There is a setConfiguration() method in web/core/modules/filter/src/Plugin/FilterBase.php, but I don't think it is relevant here.

    Tests are passing without this code, and I can't think of any reason why it might be necessary.

    Thoughts?

    -mike

  • Merge request !25Removed unecessary code. → (Merged) created by ultimike
  • 🇮🇪Ireland lostcarpark

    I have reviewed, and I agree that merging with the default settings isn't doing anything useful.

    I also agree returning an empty string for tips in defaultSettings isn't necessary.

    Moving to RTBC.

  • Pipeline finished with Success
    9 days ago
    Total: 300s
    #563724
  • Pipeline finished with Success
    9 days ago
    Total: 297s
    #563728
  • 🇮🇪Ireland lostcarpark

    I've removed "tips" from the schema and default Markdown text format. I don't think it's needed, and it is never updated by the settings form, so it will only ever be an empty string.

    I've also removed the "Convert line breaks" filter from some tests where it's not relevant.

    Also removed a check that the "Convert line breaks" error is not displayed. The error message is no longer in the module, so will never be displayed.

    Moving back to needs review.

  • Pipeline finished with Skipped
    9 days ago
    #563743
    • ultimike committed 17e01fe9 on 2.0.x
      Issue #3533958 by ultimike, lostcarpark: Doublecheck settings being...
  • 🇺🇸United States ultimike Florida, USA

    @lostcarpark - thanks so much, the changes look good and all tests are passing. Merging!

    thanks,
    -mike

Production build 0.71.5 2024