-
Notifications
You must be signed in to change notification settings - Fork 38
Add a text that clarifies whether a field column is for field value or label #2326
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: master
Are you sure you want to change the base?
Add a text that clarifies whether a field column is for field value or label #2326
Conversation
## Walkthrough
The update introduces a new private static method to the `FrmEntriesController` class for formatting field names in entry list columns. This method, `maybe_format_field_name_for_column_title`, appends either "(Value)" or "(Label)" to the truncated field name for specific field types ('select', 'radio', or 'checkbox'), depending on a boolean parameter. The `add_field_cols` method is refactored to utilize this new method, ensuring consistent and centralized formatting of field names for these option fields.
## Changes
| File(s) | Change Summary |
|----------------------------------------------|---------------------------------------------------------------------------------------------------------------------|
| classes/controllers/FrmEntriesController.php | Added private static method for conditional field name formatting; refactored `add_field_cols` to use this method. |
## Suggested labels
`run analysis`, `run tests`
## Suggested reviewers
- truongwp
- Crabcyborg 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (5)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Thanks @AbdiTolesa. This looks good.
@Crabcyborg Do we need to shorten the field label because we append some string?
} | ||
|
||
$columns[ $form_id . '_' . $col_id ] = FrmAppHelper::truncate( $field->name, 35 ); | ||
$columns[ $form_id . '_' . $col_id ] = self::maybe_format_field_name_for_title( $field, $has_separate_value, false ); |
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.
@AbdiTolesa It seems to me that the condition isn't really $has_separate_value
, but $has_separate_value && ! $is_post_status
(above).
When it is post status, it doesn't add a second column, so there isn't really a need in adding (Value)
in that case.
Maybe another variable would be more clear. Something like $include_column_for_sep_val = $has_separate_value && ! $is_post_status;
?
Related Slack conversation: https://strategy11.slack.com/archives/C799A2R61/p1745575960753219