-
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
base: trunk
Are you sure you want to change the base?
Changes from all commits
fac0065
6f6ae98
d90e587
6e794d3
3bb66c4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,6 +28,7 @@ | |
| // 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 @@ | |
| // 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()) { | ||
|
Check failure on line 80 in includes/forms/form-user.php
|
||
| return; | ||
| } | ||
|
|
||
| $screen = function_exists('get_current_screen') ? get_current_screen() : null; | ||
|
Check failure on line 84 in includes/forms/form-user.php
|
||
| if (!$screen || !in_array($screen->base, array('profile', 'user-edit'), true)) { | ||
|
Check failure on line 85 in includes/forms/form-user.php
|
||
| 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? |
||
|
|
||
|
|
||
| /** | ||
|
|
||
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.