Default field enhancer for each field type

Created on 11 January 2019, over 5 years ago
Updated 1 March 2024, 4 months ago

Problem/Motivation

Field Enhancers are a great tool, but some times it can be taxing to add the field enhancer you need on each instance of a field type.

Proposed resolution

Have a form where you can set a field enhancer to be used whenever none is specified for a given field type. We should also introduce a NULL field enhancer that removes any default enhancer that a field could get.

Remaining tasks

Determine the editorial UI for this.

Feature request
Status

Needs work

Version

3.0

Component

Code

Created by

e0ipso Can Picafort

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

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇺🇸United States jeffschuler Boulder, Colorado

    +1 for this.

    I want to apply the UrlLinkEnhancer to every Link field in all my entities...

  • Pipeline finished with Skipped
    about 1 year ago
    #12370
  • Pipeline finished with Skipped
    12 months ago
    #13639
  • Pipeline finished with Success
    9 months ago
    Total: 393s
    #21608
  • Pipeline finished with Canceled
    9 months ago
    Total: 120s
    #22481
  • Pipeline finished with Success
    9 months ago
    Total: 141965s
    #22483
  • Pipeline finished with Canceled
    9 months ago
    Total: 102s
    #23029
  • Pipeline finished with Success
    9 months ago
    Total: 146s
    #23030
  • Pipeline finished with Success
    8 months ago
    Total: 192s
    #33274
  • Pipeline finished with Success
    4 months ago
    Total: 1019s
    #104573
  • Pipeline finished with Failed
    4 months ago
    Total: 933s
    #104605
  • Pipeline finished with Failed
    4 months ago
    Total: 1166s
    #104621
  • Pipeline finished with Failed
    4 months ago
    Total: 157s
    #105923
  • Pipeline finished with Success
    4 months ago
    Total: 157s
    #105933
  • Pipeline finished with Success
    4 months ago
    Total: 1081s
    #106580
  • Pipeline finished with Success
    4 months ago
    Total: 1060s
    #106589
  • First commit to issue fork.
  • Merge request !41Default field enhancer for each field type → (Open) created by afinnarn
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.2.1 + Environment: PHP 8.1 & MySQL 5.7
    last update 4 months ago
    10 fail
  • Pipeline finished with Failed
    4 months ago
    Total: 196s
    #107241
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.2.1 + Environment: PHP 8.1 & MySQL 5.7
    last update 4 months ago
    11 pass, 4 fail
  • Pipeline finished with Running
    4 months ago
    #107305
  • Pipeline finished with Success
    4 months ago
    Total: 293s
    #107444
  • Status changed to Needs review 4 months ago
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.2.1 + Environment: PHP 8.1 & MySQL 5.7
    last update 4 months ago
    11 pass, 4 fail
  • 🇺🇸United States afinnarn

    Adding a patch since I've seen people do this with MRs to reference...

    This MR includes a "Field Types" form adjacent to the resource overrides, allowing users to select which field types a default enhancer can apply. Individual field instance enhancers still override the default field type enhancer.

    Originally, I listed out all the field types so users could choose to add enhancers in one big form, but the way I was doing it I ran into `max_input_vars` issue on my work QA server. So, I switched to forcing users to declare the field types they wanted to include, which is probably better anyways since most people would only want to use this on a few field types.

    I think the form and form language could be improved, but the approach of adding to FieldItemNormalizer and checking an additional config made sense to me. However, feel free to suggest whatever changes make sense...also where to add tests/what tests would be helpful for this change as I am not super experienced with PHPUnit.

    I did not add the NULL enhancer, but that wouldn't be much work to add in this pattern.

    Also, I have a disabled key in settings that I didn't implement, but it would disable all field type enhancers only allowing the field instance overrides. The benefit would be mainly for debugging where you can keep your settings but have a flag to turn off the whole field type enhancer feature.

    From the Kernel tests, I keep seeing this failure repeated, but I don't think this code change has anything to do with something in the jsonapi module.

    Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: The service "Drupal\jsonapi\Controller\TemporaryJsonapiFileFieldUploader" has a dependency on a non-existent service "file.validator". Did you mean one of these: "form_validator", "path.validator", "email.validator"?
    

    I also saw deprecations in the test logs, but other tests passed when I ran them.

  • The last submitted patch, 5: field-type-enhancer-3025283-5.patch, failed testing. View results
    - codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

  • Pipeline finished with Success
    4 months ago
    Total: 358s
    #111510
  • Pipeline finished with Success
    4 months ago
    Total: 377s
    #112200
  • Pipeline finished with Failed
    4 months ago
    Total: 1051s
    #113430
  • Pipeline finished with Canceled
    4 months ago
    Total: 852s
    #113451
  • Pipeline finished with Success
    4 months ago
    Total: 1121s
    #113463
  • Pipeline finished with Skipped
    4 months ago
    #113827
  • Pipeline finished with Failed
    4 months ago
    Total: 167s
    #116673
  • Pipeline finished with Success
    4 months ago
    Total: 343s
    #117444
  • Pipeline finished with Success
    3 months ago
    Total: 154s
    #120268
  • Pipeline finished with Success
    3 months ago
    Total: 152s
    #120308
  • Pipeline finished with Success
    3 months ago
    Total: 183s
    #120391
  • Pipeline finished with Success
    3 months ago
    Total: 148s
    #121097
  • Pipeline finished with Success
    3 months ago
    Total: 148s
    #121107
  • Pipeline finished with Success
    3 months ago
    Total: 167s
    #122389
  • Pipeline finished with Success
    3 months ago
    Total: 167s
    #122403
  • Pipeline finished with Success
    3 months ago
    Total: 240s
    #122431
  • Pipeline finished with Success
    3 months ago
    Total: 327s
    #133811
  • Pipeline finished with Success
    3 months ago
    Total: 172s
    #138065
  • Pipeline finished with Success
    3 months ago
    Total: 162s
    #139927
  • Pipeline finished with Success
    3 months ago
    Total: 321s
    #140517
  • Pipeline finished with Success
    3 months ago
    #140825
  • Pipeline finished with Success
    3 months ago
    Total: 198s
    #141704
  • Pipeline finished with Success
    3 months ago
    #141710
  • Pipeline finished with Skipped
    3 months ago
    #143232
  • Pipeline finished with Success
    3 months ago
    Total: 215s
    #143580
  • Pipeline finished with Success
    3 months ago
    Total: 195s
    #145440
  • Pipeline finished with Skipped
    3 months ago
    #145465
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.2.1 + Environment: PHP 8.1 & MySQL 5.7
    last update about 2 months ago
    10 fail
  • Pipeline finished with Failed
    about 2 months ago
    Total: 214s
    #160940
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.2.1 + Environment: PHP 8.1 & MySQL 5.7
    last update about 2 months ago
    5 pass, 8 fail
  • Pipeline finished with Failed
    about 2 months ago
    Total: 255s
    #161046
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.2.1 + Environment: PHP 8.1 & MySQL 5.7
    last update about 2 months ago
    6 pass, 6 fail
  • Pipeline finished with Failed
    about 2 months ago
    #161054
  • Pipeline finished with Skipped
    about 2 months ago
    #163579
  • Pipeline finished with Success
    about 1 month ago
    #173705
  • Pipeline finished with Success
    about 1 month ago
    Total: 305s
    #173707
  • Pipeline finished with Skipped
    about 1 month ago
    #179725
  • Pipeline finished with Success
    about 1 month ago
    Total: 195s
    #180601
  • Pipeline finished with Success
    about 1 month ago
    Total: 489s
    #181778
  • Pipeline finished with Skipped
    about 1 month ago
    #181796
  • Pipeline finished with Success
    26 days ago
    Total: 316s
    #188960
  • Pipeline finished with Failed
    25 days ago
    Total: 229s
    #189310
  • Pipeline finished with Success
    25 days ago
    Total: 638s
    #189329
  • Pipeline finished with Success
    25 days ago
    #189721
  • Pipeline finished with Success
    25 days ago
    Total: 150s
    #189730
  • Pipeline finished with Success
    25 days ago
    Total: 231s
    #189750
  • Pipeline finished with Success
    24 days ago
    #190136
  • Pipeline finished with Failed
    24 days ago
    Total: 241s
    #190200
  • Pipeline finished with Canceled
    24 days ago
    #190225
  • Pipeline finished with Success
    24 days ago
    Total: 445s
    #190233
  • Pipeline finished with Success
    24 days ago
    Total: 307s
    #190535
  • Pipeline finished with Success
    21 days ago
    Total: 238s
    #193109
  • Pipeline finished with Success
    21 days ago
    Total: 246s
    #193553
  • Pipeline finished with Success
    7 days ago
    #204803
  • Pipeline finished with Skipped
    4 days ago
    #206149
  • Pipeline finished with Skipped
    3 days ago
    #207260
  • Pipeline finished with Failed
    2 days ago
    Total: 1175s
    #208007
  • Pipeline finished with Canceled
    1 day ago
    Total: 5s
    #209149
  • Pipeline finished with Failed
    1 day ago
    Total: 753s
    #209150
Production build 0.69.0 2024