Problem/Motivation

When we install a module on the existing site and enable an extra field for content types, then the extra field will be added to each view mode. This is not convenient, because we need to disable this field on almost all view modes for all content types manually, and only some view modes will keep it.

Proposed resolution

Therefore, my proposal is to disable an extra field by default. It is much easier to enable it on 1-2 view modes where we need it rather than disable it everywhere.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

hitchshock created an issue. See original summary.

hitchshock’s picture

Status: Active » Needs review
akshay kashyap’s picture

Assigned: Unassigned » akshay kashyap
akshay kashyap’s picture

StatusFileSize
new78.88 KB
new168.63 KB
new154 KB

@hitchshock Thanks for your work on this issue.

I have tested this issue using Drupal 11.3.12-dev and Better Social Share 1.1.x-dev. However, I am still experiencing the same issue described in this ticket. The Better Social Share field is still visible in the field section and is not appearing in the disabled area after applying the changes.

The code changes seem to be reflected correctly in the relevant files, but the expected field display behavior is not being updated. I have attached a screenshot for reference.

Could you please take a look and let me know if there are any additional steps required on my end, or if I may have missed something during testing?

akshay kashyap’s picture

Status: Needs review » Needs work
hitchshock’s picture

Status: Needs work » Needs review

Hi @akshay-kashyap
The goal is to make it hidden when we just installed the module and configured extra field for entity type.

If you used the patch after that and have been already saved the view mode settings, then extra field is already added to the config, so the patch won't change anything in this case. If it in the config, only the manual update can be used, or "drush cim" if extra field is not in the config file yet (was stored only in the DB config storage).

Extra field should not be in the config to change the default visibility behaviour. Also, after applying the patch don't forget to clear the cache, to update the field component

akshay kashyap changed the visibility of the branch 3593205-content-extra-field-hidden to hidden.

akshay kashyap’s picture

StatusFileSize
new135.49 KB
new130.71 KB

Hi @hitchshock,

Thank you for the clarification.

I retested the issue following a clean installation workflow and can confirm that the patch is working as expected.

**Testing Environment:**

* Drupal 11.3.12-dev
* Better Social Share 1.1.x-dev
* PHP 8.2

**Steps Performed:**

1. Completely uninstalled the module using:
`drush pmu better_social_share -y`
2. Cleared caches with:
`drush cr`
3. Verified that no module-related configuration remained in the database.
4. Applied the MR, changing `visible => TRUE` to `visible => FALSE`.
5. Reinstalled the module using:
`drush en better_social_share -y`
6. Cleared caches again.
7. Reviewed the Manage Display settings for the Article and Basic Page content types.

**Result:**
The Better Social Share field now appears in the **Disabled** section by default across all view modes and content types, which matches the expected behaviour described in this issue.

Thank you for your guidance and for working on this improvement.

I have attached a screenshot for reference. Could you please review it and let me know if I may have missed any steps during the testing process?

Moving This issue to RTBC

akshay kashyap’s picture

Status: Needs review » Reviewed & tested by the community
hitchshock’s picture

All ok.
In theory we don't need 'drush cr' if module was reinstalled

aayushmankotia’s picture

StatusFileSize
new103.94 KB

@Akshay kashyap

I have re-tested the Better Social Share field and confirming that it is now displayed under the Disabled section by default for all content types and view modes. This behavior is consistent across the site and aligns with the expected functionality. The field remains available for administrators to enable when required, and no unexpected behavior was observed during testing.

Attached Screenshot for your reference.

img

sujan shrestha’s picture

Version: 1.1.x-dev » 1.1.8
Status: Reviewed & tested by the community » Fixed

Fixed in 1.1.8 (commit 2388a9e). The field is hidden by default, and view modes that already show it are not changed. Saving the entity types on the settings page now refreshes "Manage display" without a cache rebuild.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

hitchshock’s picture

@sujan-shrestha It seems that most maintainers have developed a bad habit of not giving credit to those who worked on a task when closing it. This is a bad habit.
Contribution record