"Promoted to front page" for new content types should default to Un-Checked

Created on 2 December 2010, over 14 years ago
Updated 19 March 2025, 4 months ago

Problem/Motivation

When creating a new content type, the default value for the "Promoted to front page" checkbox should be FALSE.

Beta phase evaluation

<!--Uncomment the relevant rows for the issue. -->

So this normal task is allowed in the drupal 8 beta since it is a prioritized usability improvement with no/very little disruption.

Proposed resolution

Write patch to Drupal 8 to change this behavior for new version of Drupal

Remaining tasks

Most recent patch failed testing, need to be fixed and resubmitted

<!-- See https://drupal.org/core-mentoring/novice-tasks for tips on identifying novice tasks. Delete or add "Novice" from the Novice? column in the table below as appropriate. Uncomment tasks as the issue advances. Update the Complete? column to indicate when they are done, and maybe reference the comment number where they were done. -->
📌 Task
Status

Needs work

Version

11.0 🔥

Component

node system

Created by

🇺🇸United States jenlampton

Live updates comments and jobs are added and updated live.
  • Usability

    Makes Drupal easier to use. Preferred over UX, D7UX, etc.

  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

  • Needs change record

    A change record needs to be drafted before an issue is committed. Note: Change records used to be called change notifications.

  • Needs reroll

    The patch will have to be re-rolled with new suggestions/changes described in the comments in the issue.

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.

  • 🇦🇺Australia acbramley

    This issue still seems relevant, I'm surprised this default comes all the way from Node's field default value.

    We'll need to start with a reroll of the changes onto an MR.

    I also noticed that we have base_field_override config in the standard install profile that says the default value of this should be 0 but that doesn't seem to actually be used on install.

  • First commit to issue fork.
  • Pipeline finished with Failed
    4 months ago
    Total: 675s
    #456701
  • 🇨🇦Canada xmacinfo Canada

    Based on #29338: Hide Promoted/Sticky fields by default in Form display , we should be marking this ticket as “Outdated” or “Duplicate”.

  • 🇦🇺Australia acbramley

    @xmacinfo no - this is different. This is making the checkbox on the NodeType form itself to be unchecked.

  • 🇨🇦Canada xmacinfo Canada

    Yes, but if we remove the checkboxes on new install, we do not need to worry about the checkbox being unchecked.

  • Pipeline finished with Canceled
    4 months ago
    Total: 182s
    #467052
  • Pipeline finished with Failed
    4 months ago
    Total: 457s
    #467054
  • Pipeline finished with Success
    4 months ago
    Total: 898s
    #467062
  • 🇦🇺Australia acbramley

    CR created https://www.drupal.org/node/3517642

    We need an upgrade path here though unfortunately.

    Currently if you:
    1. Install Standard profile on 11.x
    2. Check out this branch
    3. Clear cache
    4. Notice the Article node type no longer defaults to Promoted. Page correctly still defaults to Not Promoted because Standard ships with base_field_override config

  • 🇦🇺Australia acbramley

    Yes, but if we remove the checkboxes on new install, we do not need to worry about the checkbox being unchecked.

    We aren't removing checkboxes, we're hiding them. It actually makes more sense to default to unchecked once we hide the fields, otherwise new sites will be creating "promoted" content without the checkbox even being visible. We have to do things in small steps (see the history of this issue) otherwise we'll never get anywhere :) Just look at how many tests in core assume things are promoted by default!

  • 🇦🇺Australia acbramley

    Added a basic upgrade path, needs tests though.

  • Pipeline finished with Failed
    4 months ago
    Total: 461s
    #467094
  • Pipeline finished with Failed
    4 months ago
    Total: 667s
    #467104
  • Pipeline finished with Success
    4 months ago
    Total: 3566s
    #467864
  • Pipeline finished with Failed
    4 months ago
    Total: 175s
    #468837
  • Pipeline finished with Success
    4 months ago
    Total: 575s
    #468840
  • 🇺🇸United States dcam

    I added an update path test.

  • 🇺🇸United States smustgrave

    So I tested it out and pretty basic, creating a new content type and the promoted to front checkbox is unchecked

    Hiding old patches
    Tweaked the CR just slightly with an image for the visual people out there.

    I imagine this may break some contrib tests (hopefully not a lot) but seems like a right step.

  • 🇺🇸United States benjifisher Boston area

    We discussed this issue briefly at 📌 Drupal Usability Meeting 2025-04-11 Active . That issue will have a link to a recording of the meeting. We were primarily discussing the related issue #29338: Hide Promoted/Sticky fields by default in Form display .

    We agree that this is a good idea. Thanks for working on this issue!

    For the record, the attendees at the usability meeting were benjifisher, rkoller, and simohell.

  • 🇸🇰Slovakia poker10

    There is still one @todo in the MR - do we need to discuss that? I do not see it mentioned anywhere in this issue. Thanks!

  • 🇺🇸United States smustgrave

    Yea I think we probably do need to batch it. Know it's not likely but I have worked with sites that had 100s of content types

  • First commit to issue fork.
  • 🇮🇳India mohit_aghera Rajkot

    Updated code to use the config updater service.
    There were unrelated functional javascript test failures. Triggered the job again.

  • Pipeline finished with Success
    3 months ago
    Total: 6073s
    #486586
  • 🇺🇸United States smustgrave

    Believe that was the last outstanding question.

  • 🇨🇦Canada xmacinfo Canada

    Thank you everyone!

    Can we do a clean-up of the Issue tags? I think some of the tags are not relevant anymore.

  • 🇺🇸United States benjifisher Boston area

    The CI tests passed, but just because the "Validatable config" test is allowed to fail.

    TL;DR: I think it is worth looking at that test, but I think it is OK for it to fail for this issue.

    I am not familiar with that test, but it seems to compare the results of

    vendor/bin/drush config:inspect --statistics
    

    on the target branch (11.x) and on the feature branch.

    On the target branch, the installs drush and the config_inspector module. Then it installs the Standard profile and enables all core modules (except sdc, which is obsolete) and config_inspector. On the feature branch, the test first applies database updates.

    The test fails if any of the statistics are lower on the feature branch than they are on the target branch.

    I went through similar steps, but instead of vendor/bin/drush config:inspect --statistics, I exported configuration. The only difference between the two branches is that the feature branch includes core.base_field_override.node.article.promote.yml. It looks as though this config entity is not fully validatable: the schema is in core/config/schema/core.data_types.schema.yml, and it is not marked as FullyValidatable: ~. So it makes sense that the statistics go down and the test fails.

  • 🇦🇺Australia acbramley

    Re #225 yes this is expected since we're adding new config.

  • The Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

    This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

    Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

  • 🇺🇸United States smustgrave

    Rebased

  • Pipeline finished with Failed
    3 months ago
    Total: 183s
    #493840
  • Pipeline finished with Failed
    3 months ago
    Total: 1154s
    #493842
  • Pipeline finished with Success
    2 months ago
    Total: 543s
    #504432
  • Status changed to RTBC 2 months ago
  • 🇦🇺Australia acbramley

    Rebased again and fixed the performance tests.

  • Pipeline finished with Success
    about 1 month ago
    Total: 930s
    #529715
  • 🇺🇸United States xjm

    Saving mentor credits as per #33.

  • 🇺🇸United States xjm

    I updated the issue credit, removing credit for a number of old rerolls where the contributor did not add anything else to the issue. I left credit for a couple people who were doing the reroll in the context of a mentored event as their first contribution. I also added credits for a number of reviewers.

    I'm not able do do the review myself at the moment, but at least having the crediting in order should save some time.

  • The Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".

    This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

    Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

  • Pipeline finished with Success
    29 days ago
    Total: 697s
    #531406
  • 🇺🇸United States dcam

    Rebased. Restoring RTBC.

  • 🇬🇧United Kingdom longwave UK

    Overall this looks good but I think we can remove these overrides now?

    core/profiles/demo_umami/config/install/core.base_field_override.node.page.promote.yml
    core/profiles/standard/config/install/core.base_field_override.node.page.promote.yml
    core/recipes/page_content_type/config/core.base_field_override.node.page.promote.yml

    These seem to exist to set the promote default for these content types to false - but it's now false by default, so we shouldn't need to ship them any more?

    Also I'm intrigued why the Umami performance stats have such an improvement; I don't see why just flipping the default results in so many fewer queries?

  • 🇦🇺Australia acbramley

    These seem to exist to set the promote default for these content types to false - but it's now false by default, so we shouldn't need to ship them any more?

    Good catch, I've removed them.

    Also I'm intrigued why the Umami performance stats have such an improvement; I don't see why just flipping the default results in so many fewer queries?

    I would assume it's something to do with the base_field_overrides not being needed anymore since they match the default, I can try to dig into it further if needed.

  • Pipeline finished with Failed
    9 days ago
    Total: 503s
    #548483
  • Pipeline finished with Failed
    9 days ago
    Total: 530s
    #548487
  • Pipeline finished with Failed
    9 days ago
    Total: 777s
    #548502
  • 🇦🇺Australia acbramley

    I don't really understand these performance tests tbh, OpenTelemetryNodePagePerformanceTest was giving 450 query count on cold cache, it was passing locally then it jumped back up to 457 in CI, so I changed it locally and it still passed. I'm not even sure what I changed.

  • Pipeline finished with Success
    9 days ago
    Total: 1427s
    #548513
  • One tiny comment on the MR.

  • 🇦🇺Australia acbramley

    Crediting @godotislate and @mstrelan for helping figure out the query count discrepancy.

    Because we reversed the default, Demo Umami needed base field overrides for article and recipe content types. Without this, one of the articles had dropped off the homepage (I guess we have no tests for the actual content displayed on the umami homepage). This is what dropped the query count so drastically.

  • Pipeline finished with Success
    9 days ago
    Total: 467s
    #548538
  • 🇺🇸United States smustgrave

    Feedback appears to be addressed

  • 🇺🇸United States xjm

    #239 explained the diff weirdnesses with Umami config that were making me scratch my head, thanks!

  • 🇺🇸United States xjm

    Saving reviewer credit for @longwave. Also looks like I had missed @smustgrave's changes and nontrivial rebase back in May so saving credit for that too.

    • longwave committed 6bfec5bc on 11.x
      Issue #987238 by acbramley, jenlampton, ajalan065, idebr, nsuit, dcam,...
  • 🇬🇧United Kingdom longwave UK

    @acbramley thanks for the explanation, it did feel like the Umami change was too good to be true here, and it turns out that was correct; glad we did not break that - and technically it is tested here indirectly, because we spotted it via the performance tests!

    So, after 14 years and 240 comments by many contributors, I am happy to finally be committing what is really a one line change:

    --- a/core/modules/node/src/Entity/Node.php
    +++ b/core/modules/node/src/Entity/Node.php
    @@ -357,7 +357,7 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
           ->setLabel(t('Promoted to front page'))
           ->setRevisionable(TRUE)
           ->setTranslatable(TRUE)
    -      ->setDefaultValue(TRUE)
    +      ->setDefaultValue(FALSE)
    

    One small step towards (possibly) removing this feature in the future!

    Committed 6bfec5b and pushed to 11.x. Thanks!

    Also finalised and published the change record.

    • longwave committed e2180650 on 11.x
      Issue #987238 followup by xjm: "Promoted to front page" for new content...
  • 🇬🇧United Kingdom longwave UK

    Managed to crosspost with @xjm while we were both reviewing, committed her comment improvement as a followup.

  • 🇺🇸United States xjm

    Also a potential highlights thing, especially if we end up with other site builder UX tweaks.

  • 🇦🇺Australia acbramley

    Great to finally get this in, thanks both.

Production build 0.71.5 2024