-
Notifications
You must be signed in to change notification settings - Fork 52
Docs: Improve local development and contribution instructions #363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
meravi
wants to merge
5
commits into
WordPress:trunk
Choose a base branch
from
meravi:docs/contributing-improvements
base: trunk
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
fac0065
Fix: user profile/edit SCF field table layout (Fixes #349)
meravi 6f6ae98
Docs: improve local development and PR contribution instructions
meravi d90e587
Docs: add local development and PR guidance
meravi 6e794d3
Merge branch 'trunk' into docs/contributing-improvements
meravi 3bb66c4
Merge branch 'WordPress:trunk' into docs/contributing-improvements
meravi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,6 +28,7 @@ function __construct() { | |
| // enqueue | ||
| add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) ); | ||
| add_action( 'login_form_register', array( $this, 'login_form_register' ) ); | ||
| add_action( 'admin_head', array( $this, 'scf_user_form_layout_fix' ), 20 ); | ||
|
|
||
| // render | ||
| add_action( 'show_user_profile', array( $this, 'render_edit' ) ); | ||
|
|
@@ -64,6 +65,82 @@ function admin_enqueue_scripts() { | |
| // enqueue | ||
| acf_enqueue_scripts(); | ||
| } | ||
| /** | ||
| * Fix SCF field layout on user profile/edit screens. | ||
| * | ||
| * SCF fields on user screens render inside WordPress `table.form-table` rows, | ||
| * so we apply scoped CSS only on profile.php and user-edit.php screens. | ||
| * | ||
| * @see https://github.com/WordPress/secure-custom-fields/issues/349 | ||
| */ | ||
| function scf_user_form_layout_fix() | ||
| { | ||
|
|
||
| // Only run in wp-admin, and only on profile/edit user screens. | ||
| if (!is_admin()) { | ||
| return; | ||
| } | ||
|
|
||
| $screen = function_exists('get_current_screen') ? get_current_screen() : null; | ||
| if (!$screen || !in_array($screen->base, array('profile', 'user-edit'), true)) { | ||
| return; | ||
| } | ||
|
|
||
| ?> | ||
| <style id="scf-user-form-layout-fix"> | ||
| /* Labels: consistent width + alignment */ | ||
| body.profile-php table.form-table tr.acf-field > td.acf-label, | ||
| body.user-edit-php table.form-table tr.acf-field > td.acf-label { | ||
| width: 200px; | ||
| vertical-align: top; | ||
| padding-top: 14px; | ||
| } | ||
|
|
||
| /* Inputs: align to top */ | ||
| body.profile-php table.form-table tr.acf-field > td.acf-input, | ||
| body.user-edit-php table.form-table tr.acf-field > td.acf-input { | ||
| vertical-align: top; | ||
| } | ||
|
|
||
| /* Make text inputs and textareas usable width (WP-like) */ | ||
| body.profile-php table.form-table tr.acf-field > td.acf-input .acf-input-wrap input, | ||
| body.profile-php table.form-table tr.acf-field > td.acf-input textarea, | ||
| body.user-edit-php table.form-table tr.acf-field > td.acf-input .acf-input-wrap input, | ||
| body.user-edit-php table.form-table tr.acf-field > td.acf-input textarea { | ||
| width: 100%; | ||
| max-width: 25em; | ||
| } | ||
|
|
||
| /* Select2: keep full width, not squeezed */ | ||
| body.profile-php table.form-table tr.acf-field > td.acf-input .select2-container, | ||
| body.user-edit-php table.form-table tr.acf-field > td.acf-input .select2-container { | ||
| width: 100% !important; | ||
| max-width: 25em; | ||
| } | ||
|
|
||
| /* Mobile: stack label + field */ | ||
| @media (max-width: 782px) { | ||
| body.profile-php table.form-table tr.acf-field > td.acf-label, | ||
| body.user-edit-php table.form-table tr.acf-field > td.acf-label, | ||
| body.profile-php table.form-table tr.acf-field > td.acf-input, | ||
| body.user-edit-php table.form-table tr.acf-field > td.acf-input { | ||
| display: block; | ||
| width: auto; | ||
| } | ||
|
|
||
| body.profile-php table.form-table tr.acf-field > td.acf-input .acf-input-wrap input, | ||
| body.profile-php table.form-table tr.acf-field > td.acf-input textarea, | ||
| body.user-edit-php table.form-table tr.acf-field > td.acf-input .acf-input-wrap input, | ||
| body.user-edit-php table.form-table tr.acf-field > td.acf-input textarea, | ||
| body.profile-php table.form-table tr.acf-field > td.acf-input .select2-container, | ||
| body.user-edit-php table.form-table tr.acf-field > td.acf-input .select2-container { | ||
| max-width: 100%; | ||
| } | ||
| } | ||
| </style> | ||
| <?php | ||
| } | ||
|
|
||
|
Comment on lines
+68
to
+143
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These changes seem unrelated to the doc changes. Maybe commit fac0065 was added accidentally to this PR and should be reverted? |
||
|
|
||
|
|
||
| /** | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While this is possible, it might not be the best way to develop SCF. There are other ways to keep the local clone of the repository better separated from the WordPress install that's used to test it with, including
wp-env(which is referenced inAGENTS.md-- we might want the README to be consistent with that), or using a different WordPress development environment such as WordPress Studio, and symlinking the repository from that environmentswp-content/plugins/directory.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, thanks for clarifying. I’ll align with wp-env (as referenced in AGENTS.md) or use a separate dev environment with symlinking for future work to keep things consistent.