-
-
Notifications
You must be signed in to change notification settings - Fork 0
Release v2.1 - Plugin Structure Refactoring and Field Improvements #111
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
Conversation
- Removed old class files for frontend, schema, and admin functionalities. - Introduced new class files for team management with updated methods and properties. - Updated main plugin file to reflect new class structure and file names. - Enhanced template registration for block templates. - Improved handling of custom fields and taxonomy configurations.
…into 2.0.1-trunk
|
Warning Rate limit exceeded@krugazul has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 1 minutes and 25 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (9)
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughBumps the plugin to 2.0.1, renames class files from Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
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. Comment |
Summary of ChangesHello @krugazul, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This release focuses on modernizing and streamlining the plugin's architecture and user experience. It introduces a significant refactoring of the internal class structure and template system, ensuring better readability, maintainability, and compatibility with the latest WordPress block editor features. Additionally, custom field configurations have been enhanced to provide clearer labeling and improved integration with Tour Operator 2.0, alongside general codebase cleanups and asset updates. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request introduces a significant refactoring of the plugin structure, updates custom fields, and adds new block templates. The changes align well with the goal of improving maintainability and compatibility with Tour Operator 2.0.
My review includes several suggestions to enhance code quality and consistency:
- Correcting a broken link in the changelog.
- Aligning a new class name with the refactoring pattern.
- Improving PHPDoc accuracy and removing unused code.
- Fixing a potential bug in block template registration.
- Ensuring consistent use of the text domain for translations.
- Improving the approach for creating translatable strings.
- Making block template queries more explicit.
Overall, this is a solid update. Addressing these points will further improve the codebase.
| } | ||
|
|
||
| if ( function_exists( 'register_block_template' ) ) { | ||
| register_block_template( 'lsx-tour-operator//' . $key, $args ); |
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.
changelog.md
Outdated
| @@ -1,5 +1,13 @@ | |||
| # Change log | |||
|
|
|||
| ## [[2.0.1]](https://github.com/lightspeeddevelopment/to-reviews/releases/tag/2.0.1) - WIP | |||
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.
The link for the release tag points to the to-reviews repository. Based on other links in this file and the context of this repository, it should likely point to the to-team repository. Please verify and correct the URL.
| ## [[2.0.1]](https://github.com/lightspeeddevelopment/to-reviews/releases/tag/2.0.1) - WIP | |
| ## [[2.0.1]](https://github.com/lightspeeddevelopment/to-team/releases/tag/2.0.1) - WIP |
| * @version 1.0.0 | ||
| */ | ||
|
|
||
| class LSX_TO_Team_Templates { |
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.
The PR description mentions a major refactoring to rename classes from class-lsx-to-* to class-to-*. This new class LSX_TO_Team_Templates still uses the old LSX_TO_ prefix. For consistency with the refactoring, consider renaming it to TO_Team_Templates and also the file name.
class TO_Team_Templates {| /** | ||
| * Holds array of out templates to be registered. | ||
| * | ||
| * @var array | ||
| */ | ||
| public $templates = []; |
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.
| * | ||
| * @since 1.0.0 | ||
| * | ||
| * @access private |
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.
| * @param [type] $template | ||
| * @return void |
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.
| foreach ( $post_types as $slug => $label ) { | ||
| $metabox['fields'][] = array( | ||
| 'id' => $slug . '_to_team', | ||
| 'name' => $label . esc_html__( ' related with this team', 'to-team' ), |
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.
Concatenating strings for translation can be problematic, as the word order might change in different languages. It's better to use sprintf with a placeholder for the variable part of the string. This gives translators more context and flexibility, and avoids issues like the leading space in the current translatable string.
'name' => sprintf( esc_html__( '%s related with this team', 'to-team' ), $label ),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.
Actionable comments posted: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
includes/metaboxes/config-team.php (1)
54-61: Fix the user array construction logic.The foreach loop overwrites the
$usersarray on each iteration instead of appending to it. This results in only the last user being retained.🔎 Proposed fix
if ( ! empty( $user_results ) ) { foreach ( $user_results as $user ) { - $users = array( + $users[] = array( 'name' => $user->display_name, 'value' => $user->ID, ); } }
📜 Review details
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
⛔ Files ignored due to path filters (9)
.wordpress-org/.DS_Storeis excluded by!**/.DS_Store.wordpress-org/banner-1544x500.jpgis excluded by!**/*.jpg.wordpress-org/banner-1544x500.pngis excluded by!**/*.png.wordpress-org/banner-772x250.jpgis excluded by!**/*.jpg.wordpress-org/banner-772x250.pngis excluded by!**/*.png.wordpress-org/icon-128x128.jpgis excluded by!**/*.jpg.wordpress-org/icon-128x128.pngis excluded by!**/*.png.wordpress-org/icon-256x256.jpgis excluded by!**/*.jpg.wordpress-org/icon-256x256.pngis excluded by!**/*.png
📒 Files selected for processing (8)
changelog.md(1 hunks)classes/class-to-team-admin.php(2 hunks)classes/class-to-team-templates.php(1 hunks)classes/class-to-team.php(2 hunks)includes/metaboxes/config-team.php(3 hunks)templates/archive-team.html(1 hunks)templates/single-team.html(1 hunks)to-team.php(2 hunks)
🧰 Additional context used
🪛 markdownlint-cli2 (0.18.1)
changelog.md
5-5: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
8-8: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
🪛 PHPMD (2.15.0)
classes/class-to-team-templates.php
9-79: The class LSX_TO_Team_Templates is not named in CamelCase. (undefined)
(CamelCaseClassName)
34-66: The method register_post_type_templates is not named in camelCase. (undefined)
(CamelCaseMethodName)
39-39: The variable $post_types is not named in camelCase. (undefined)
(CamelCaseVariableName)
74-78: The method get_template_content is not named in camelCase. (undefined)
(CamelCaseMethodName)
🔇 Additional comments (11)
includes/metaboxes/config-team.php (1)
191-209: LGTM! Well-structured Related section.The new "Related" section title and updated post-type fields with
pw_multiselectand simplified options structure align well with Tour Operator 2.0. The addition of the'post'post type extends team member associations effectively.templates/single-team.html (1)
1-13: LGTM! Clean block template structure.The single team member template follows WordPress block template conventions correctly, with appropriate template parts, spacing, and content blocks.
classes/class-to-team.php (1)
79-91: LGTM! File path updates are consistent.The updated require_once statements correctly reflect the class file naming refactor from
class-lsx-to-team-*toclass-to-team-*, and the new templates class inclusion integrates the block template registration feature.classes/class-to-team-admin.php (2)
39-39: LGTM! Post type integration added.The new
lsx_to_post_custom_fieldsfilter correctly extends team member relationships to standard WordPress posts, aligning with the metabox configuration changes.
118-129: LGTM! Improved field label translation.Using the translation function with a consistent label improves maintainability and i18n support.
to-team.php (3)
6-6: LGTM! Version bump to 2.0.1.The version update is consistent with the release objectives.
23-23: LGTM! Version constant updated.The LSX_TO_TEAM_VER constant is correctly updated to match the plugin version.
31-31: LGTM! Class file path updated.The inclusion path correctly reflects the class file naming refactor.
templates/archive-team.html (1)
1-59: LGTM! Well-structured archive template.The template provides a comprehensive archive layout with proper header, breadcrumbs, query loop, pagination, no-results handling, and footer. The two-column layout with featured image and excerpt is appropriate for team member listings.
classes/class-to-team-templates.php (2)
9-79: LGTM! Well-implemented template registration system.The class correctly implements WordPress block template registration with proper hooks, conditional function checks, and template content loading. The use of output buffering to load template files is a standard WordPress pattern.
Note: The PHPMD CamelCase warnings are false positives—WordPress coding standards use underscored naming for class methods and properties, which this code follows correctly.
62-64: Template registration function properly aligns with version requirements.The plugin requires WordPress 6.7 as a minimum, which matches the version where
register_block_template()was introduced. Thefunction_exists()check is good defensive programming and ensures compatibility across the supported versions (6.7–6.8).
includes/metaboxes/config-team.php
Outdated
| 'name' => esc_html__( 'Gallery', 'tour-operator-team' ), | ||
| 'desc' => esc_html__( 'Add images related to the accommodation to be displayed in the Accommodation\'s gallery.', 'tour-operator-team' ), | ||
| 'id' => 'gallery', | ||
| 'type' => 'file_list', | ||
| 'preview_size' => 'thumbnail', // Image size to use when previewing in the admin. | ||
| 'query_args' => array( 'type' => 'image' ), // Only images attachment | ||
| 'text' => array( | ||
| 'add_upload_files_text' => esc_html__( 'Add new image', 'tour-operator-team' ), // default: "Add or Upload Files" | ||
| ), |
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.
Use consistent text domain across the plugin.
The text domain 'tour-operator-team' differs from 'to-team' used throughout the rest of the file and plugin. Text domain inconsistencies can cause translation issues.
🔎 Proposed fix
- 'name' => esc_html__( 'Gallery', 'tour-operator-team' ),
- 'desc' => esc_html__( 'Add images related to the accommodation to be displayed in the Accommodation\'s gallery.', 'tour-operator-team' ),
+ 'name' => esc_html__( 'Gallery', 'to-team' ),
+ 'desc' => esc_html__( 'Add images related to the team member to be displayed in the gallery.', 'to-team' ),
'id' => 'gallery',
'type' => 'file_list',
'preview_size' => 'thumbnail', // Image size to use when previewing in the admin.
'query_args' => array( 'type' => 'image' ), // Only images attachment
'text' => array(
- 'add_upload_files_text' => esc_html__( 'Add new image', 'tour-operator-team' ), // default: "Add or Upload Files"
+ 'add_upload_files_text' => esc_html__( 'Add new image', 'to-team' ), // default: "Add or Upload Files"
),Note: Also updated the description text to reference "team member" instead of "accommodation".
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| 'name' => esc_html__( 'Gallery', 'tour-operator-team' ), | |
| 'desc' => esc_html__( 'Add images related to the accommodation to be displayed in the Accommodation\'s gallery.', 'tour-operator-team' ), | |
| 'id' => 'gallery', | |
| 'type' => 'file_list', | |
| 'preview_size' => 'thumbnail', // Image size to use when previewing in the admin. | |
| 'query_args' => array( 'type' => 'image' ), // Only images attachment | |
| 'text' => array( | |
| 'add_upload_files_text' => esc_html__( 'Add new image', 'tour-operator-team' ), // default: "Add or Upload Files" | |
| ), | |
| 'name' => esc_html__( 'Gallery', 'to-team' ), | |
| 'desc' => esc_html__( 'Add images related to the team member to be displayed in the gallery.', 'to-team' ), | |
| 'id' => 'gallery', | |
| 'type' => 'file_list', | |
| 'preview_size' => 'thumbnail', // Image size to use when previewing in the admin. | |
| 'query_args' => array( 'type' => 'image' ), // Only images attachment | |
| 'text' => array( | |
| 'add_upload_files_text' => esc_html__( 'Add new image', 'to-team' ), // default: "Add or Upload Files" | |
| ), |
🤖 Prompt for AI Agents
In includes/metaboxes/config-team.php around lines 138 to 146, the strings in
this gallery field use the text domain 'tour-operator-team' (and reference
"accommodation") which is inconsistent with the rest of the plugin; change the
text domain to 'to-team' for all esc_html__ calls in this block and update the
description text to reference "team member" instead of "accommodation" so
translations are consistent and the description matches the metabox context.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Signed-off-by: Warwick Booth <[email protected]>
…into 2.0.1-trunk
…ng conventions in metabox config
Release v2.1 - Plugin Structure Refactoring and Field Improvements
Overview
This release includes significant refactoring of the plugin structure, improved template registration, and enhanced custom field configurations for better Tour Operator 2.0 compatibility.
Changes Summary
🏗️ Major Refactoring
Class Structure Overhaul: Refactored plugin class structure for improved readability and maintainability
class-lsx-to-*toclass-to-*for consistencyclass-lsx-to-team.php→class-to-team.phpclass-lsx-to-team-admin.php→class-to-team-admin.phpclass-lsx-to-team-frontend.php→class-to-team-frontend.phpclass-lsx-to-team-schema.php→class-to-team-schema.phpTemplate System:
LSX_TO_Specials_Templates→LSX_TO_Team_Templatesclass-to-specials-templates.phpclass-to-team-templates.phpfor proper template managementarchive-team.htmlandsingle-team.html🔧 Field Improvements
🎨 Assets & UI
📄 Templates
templates/archive-team.html(59 lines)templates/single-team.html(13 lines)Technical Details
Commit History
86ade3c- Updating field titlea571c70- Adding post field support266873e- Updating Team Metabox namesed1c9cc- Fixing references to specials02ce34d- Updating changelog1c7e45e- Updating team connection fieldsb338caa- Rename LSX_TO_Specials_Templates1da8b6d- Refactor class structure538edf2- Remove unnecessary inclusion37f5781- Major refactor33130f1- Updating plugin assetsTesting Recommendations
Contributors
Merge Checklist:
Summary by CodeRabbit
New Features
Improvements
Version
✏️ Tip: You can customize this high-level summary in your review settings.