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.
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | After-MR_!6.png | 103.94 KB | aayushmankotia |
| #9 | AfterMR-Field-screenshot.png | 130.71 KB | akshay kashyap |
| #9 | AfterMr.png | 135.49 KB | akshay kashyap |
| #5 | After-merge-code-1.png | 154 KB | akshay kashyap |
| #5 | After-merging-code.png | 168.63 KB | akshay kashyap |
Issue fork better_social_share-3593205
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:
- 3593205-content-extra-field-hidden
changes, plain diff MR !6
Comments
Comment #3
hitchshockComment #4
akshay kashyap commentedComment #5
akshay kashyap commented@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?
Comment #6
akshay kashyap commentedComment #7
hitchshockHi @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
Comment #9
akshay kashyap commentedHi @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
Comment #10
akshay kashyap commentedComment #11
hitchshockAll ok.
In theory we don't need 'drush cr' if module was reinstalled
Comment #12
aayushmankotia commented@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.
Comment #13
sujan shrestha commentedFixed 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.
Comment #15
hitchshock@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