Skip to content

Conversation

@krugazul
Copy link
Contributor

@krugazul krugazul commented Dec 20, 2025

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

    • Renamed class files from class-lsx-to-* to class-to-* for consistency
    • Updated class-lsx-to-team.phpclass-to-team.php
    • Updated class-lsx-to-team-admin.phpclass-to-team-admin.php
    • Updated class-lsx-to-team-frontend.phpclass-to-team-frontend.php
    • Updated class-lsx-to-team-schema.phpclass-to-team-schema.php
  • Template System:

    • Fixed incorrect class naming: Renamed LSX_TO_Specials_TemplatesLSX_TO_Team_Templates
    • Removed unnecessary inclusion of class-to-specials-templates.php
    • Added new class-to-team-templates.php for proper template management
    • Registered block templates: archive-team.html and single-team.html

🔧 Field Improvements

  • Updated team metabox field names for better clarity
  • Added post field support for enhanced content management
  • Updated team connection fields for Tour Operator 2.0 compatibility
  • Fixed references from 'specials' to 'team' throughout the codebase
  • Improved field title handling

🎨 Assets & UI

  • Updated plugin assets (banners and icons)
    • Converted banner images from JPG to PNG format
    • Updated icon-128x128 and icon-256x256 to PNG
    • Refreshed visual branding elements

📄 Templates

  • Added block editor templates:
    • templates/archive-team.html (59 lines)
    • templates/single-team.html (13 lines)
  • Enhanced template registration for block editor support

Technical Details

  • Files Changed: 19 files
  • Additions: +196 lines
  • Deletions: -43 lines
  • Version: Bumped to 2.0.1

Commit History

  1. 86ade3c - Updating field title
  2. a571c70 - Adding post field support
  3. 266873e - Updating Team Metabox names
  4. ed1c9cc - Fixing references to specials
  5. 02ce34d - Updating changelog
  6. 1c7e45e - Updating team connection fields
  7. b338caa - Rename LSX_TO_Specials_Templates
  8. 1da8b6d - Refactor class structure
  9. 538edf2 - Remove unnecessary inclusion
  10. 37f5781 - Major refactor
  11. 33130f1 - Updating plugin assets

Testing Recommendations

  • Test team member creation and editing
  • Verify custom field functionality
  • Check archive and single page templates render correctly
  • Validate Tour Operator 2.0 integration
  • Test connection fields with related post types

Contributors


Merge Checklist:

  • All automated tests pass
  • Manual testing completed
  • Changelog updated
  • Version numbers updated in all files
  • Documentation reviewed

Summary by CodeRabbit

  • New Features

    • Added block-based templates for team archive and single pages with improved layout and pagination.
    • Introduced a file-based Media gallery and enhanced related-team selection with multiselect support.
  • Improvements

    • Renamed "Gallery" to "Media" and refined metabox field layouts and labels for clarity.
    • Improved related-team field labeling and per-post-type selection behavior.
  • Version

    • Updated plugin to 2.0.1 and added changelog entry.

✏️ Tip: You can customize this high-level summary in your review settings.

krugazul and others added 13 commits May 16, 2025 09:22
- 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.
@krugazul krugazul linked an issue Dec 20, 2025 that may be closed by this pull request
33 tasks
@coderabbitai
Copy link

coderabbitai bot commented Dec 20, 2025

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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.

📥 Commits

Reviewing files that changed from the base of the PR and between b3772f2 and 522c117.

📒 Files selected for processing (9)
  • changelog.md (1 hunks)
  • includes/metaboxes/config-team.php (4 hunks)
  • languages/to-team-en_EN.po (4 hunks)
  • languages/to-team-en_US.po (4 hunks)
  • languages/to-team.pot (4 hunks)
  • package.json (1 hunks)
  • readme.txt (1 hunks)
  • templates/archive-team.html (1 hunks)
  • to-team.php (2 hunks)

Note

Other AI code review bot(s) detected

CodeRabbit 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.

Walkthrough

Bumps the plugin to 2.0.1, renames class files from class-lsx-to-team-* to class-to-team-*, adds a templates registration class and two block templates, updates admin custom-field hook and label, and refactors metaboxes (Gallery → Media, pw_multiselect replacements, new Related section).

Changes

Cohort / File(s) Summary
Version & bootstrap
changelog.md, to-team.php
Plugin version updated to 2.0.1; changelog entry added; header constant LSX_TO_TEAM_VER updated; main include path adjusted to new class filename.
Core class file rename
classes/class-to-team.php
Replaced previous includes to use class-to-team-* filenames and added inclusion of the new templates class.
Templates registration class
classes/class-to-team-templates.php
New class LSX_TO_Team_Templates added to register two block templates (single and archive) and load template content from templates/*.html.
Admin custom fields
classes/class-to-team-admin.php
Registered filter lsx_to_post_custom_fields mapping to custom_fields and changed the related-team custom field label to a translatable string.
Metabox configuration
includes/metaboxes/config-team.php
Removed unused loop, renamed "Gallery" → "Media" and replaced with file_list; Envira gallery fields switched to pw_multiselect; added Related title and converted post-association fields to pw_multiselect with updated args.
Block templates
templates/single-team.html, templates/archive-team.html
Added block-based templates: single-team.html (post title, featured image, content) and archive-team.html (two-column list, pagination, no-results fallback).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Areas to focus on:
    • classes/class-to-team-templates.php — template content loading and conditional register_block_template usage.
    • includes/metaboxes/config-team.php — verify file_list and pw_multiselect configurations, query args and translation text domains.
    • classes/class-to-team-admin.php — filter registration timing and translation context for the label.
    • templates/*.html — ensure block markup matches theme expectations and has correct spacing/patterns.

Poem

A rabbit nibbles keys by night, 🐰
Templates settled, fields set right,
Names refined and versions spun,
Two new pages, work all done,
Hooray — 2.0.1 takes flight!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title states 'Release v2.1' but the changelog and version constant were bumped to 2.0.1, creating a significant discrepancy between the title and actual changes. Update the PR title to accurately reflect version 2.0.1 instead of 2.1, for example: 'Release v2.0.1 - Plugin Structure Refactoring and Field Improvements'.
✅ Passed checks (2 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @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

  • Plugin Structure Refactoring: Core plugin class files have been renamed for consistency (e.g., "class-lsx-to-" to "class-to-") to improve overall maintainability and readability.
  • Enhanced Template System: The template system has been significantly improved by correcting class naming, removing obsolete inclusions, introducing a new dedicated template management class ("class-to-team-templates.php"), and registering new block editor templates ("archive-team.html" and "single-team.html").
  • Improved Custom Field Configurations: Team metabox field names have been updated for clarity, support for post fields has been added, and team connection fields have been refined for better compatibility with Tour Operator 2.0.
  • Codebase Consistency: Numerous references from 'specials' to 'team' have been fixed across the codebase to ensure accurate terminology and consistency.
  • Asset Updates: Plugin assets, including banner images and icons, have been refreshed and converted to PNG format for improved visual quality.
  • Version Bump: The plugin version has been updated from 2.0.0 to 2.0.1.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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 );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

There is a double slash (//) in the block template name being registered. This is likely a typo and could cause issues with template resolution. It should be a single slash.

				register_block_template( 'lsx-tour-operator/' . $key, $args );

changelog.md Outdated
@@ -1,5 +1,13 @@
# Change log

## [[2.0.1]](https://github.com/lightspeeddevelopment/to-reviews/releases/tag/2.0.1) - WIP
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
## [[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 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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 {

Comment on lines +11 to +16
/**
* Holds array of out templates to be registered.
*
* @var array
*/
public $templates = [];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The class property $templates is declared but appears to be unused within the class. If it's not needed, it and its docblock should be removed to improve code clarity.

*
* @since 1.0.0
*
* @access private
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The docblock for the constructor specifies @access private, but the constructor itself is public. Please correct the docblock to reflect the method's visibility.

	 * @access public

Comment on lines +71 to +72
* @param [type] $template
* @return void
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The PHPDoc for get_template_content has incorrect type hints. The $template parameter is a string, and the function returns a string (from ob_get_clean()), not void. Please update the docblock for accuracy.

	 * @param string $template
	 * @return string

foreach ( $post_types as $slug => $label ) {
$metabox['fields'][] = array(
'id' => $slug . '_to_team',
'name' => $label . esc_html__( ' related with this team', 'to-team' ),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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 ),

Copy link

@coderabbitai coderabbitai bot left a 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 $users array 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

📥 Commits

Reviewing files that changed from the base of the PR and between 2377c5f and 86ade3c.

⛔ Files ignored due to path filters (9)
  • .wordpress-org/.DS_Store is excluded by !**/.DS_Store
  • .wordpress-org/banner-1544x500.jpg is excluded by !**/*.jpg
  • .wordpress-org/banner-1544x500.png is excluded by !**/*.png
  • .wordpress-org/banner-772x250.jpg is excluded by !**/*.jpg
  • .wordpress-org/banner-772x250.png is excluded by !**/*.png
  • .wordpress-org/icon-128x128.jpg is excluded by !**/*.jpg
  • .wordpress-org/icon-128x128.png is excluded by !**/*.png
  • .wordpress-org/icon-256x256.jpg is excluded by !**/*.jpg
  • .wordpress-org/icon-256x256.png is 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_multiselect and 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-* to class-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_fields filter 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. The function_exists() check is good defensive programming and ensures compatibility across the supported versions (6.7–6.8).

Comment on lines 138 to 146
'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"
),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

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.

Suggested change
'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.

@krugazul krugazul changed the title Release v2.0.1 - Plugin Structure Refactoring and Field Improvements Release v2.1 - Plugin Structure Refactoring and Field Improvements Dec 20, 2025
@github-project-automation github-project-automation bot moved this to Needs Triage in Tour Operator Dec 20, 2025
@krugazul krugazul moved this from Needs Triage to 🏗️ In Progress in Tour Operator Dec 20, 2025
@krugazul krugazul added this to the v2.1.0 milestone Dec 20, 2025
@krugazul krugazul self-assigned this Dec 20, 2025
@krugazul krugazul merged commit c01b611 into master Dec 20, 2025
5 of 7 checks passed
@github-project-automation github-project-automation bot moved this from 🏗️ In Progress to ✅ Done in Tour Operator Dec 20, 2025
@krugazul krugazul deleted the 2.0.1-trunk branch December 20, 2025 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

Add Block-Based Templates for Team Members

3 participants