Skip to content

Conversation

@ShubhamGupta05
Copy link
Contributor

@ShubhamGupta05 ShubhamGupta05 commented Jul 31, 2025

Description

Main Purpose: This pull request implements significant backend functionality to enhance the Header Footer Elementor (HFE) Builder, introducing REST API endpoints to manage display conditions and custom layouts more effectively.

Key Changes:

  • In class-hfe-admin.php, added a show_in_rest parameter for custom post types to ensure compatibility with the WordPress REST API.
  • In hfe-settings-api.php, registered multiple new REST API routes (e.g., /target-rules, /create-layout, /target-rules-options) to handle fetching and saving display conditions for headers and footers.
  • Enhanced the AllLayouts.jsx component to utilize the new API for fetching target rule options and creating layouts dynamically, improving user interaction by allowing users to save and manage conditions directly from the UI.
  • Changes were made to styling and structure in various components, particularly SidebarMenu.jsx, to improve the user interface and guide users towards upgrade options.

Additional Notes: Reviewers should focus on the newly registered API endpoints to ensure they function correctly with the expected request and response formats, including user permissions handling. Additionally, verify the frontend integration in AllLayouts.jsx for correct API interaction and UI behavior changes. Consider potential impacts on existing user workflows due to the addition of these features. Testing will be crucial to validate that display conditions are saved and fetched as intended.

Screenshots

Types of changes

How has this been tested?

Checklist:

  • My code is tested
  • My code passes the PHPCS tests
  • My code follows accessibility standards
  • My code has proper inline documentation
  • I've included any necessary tests
  • I've included developer documentation
  • I've added proper labels to this pull request
'show_in_menu' => false,
'show_in_nav_menus' => false,
'exclude_from_search' => true,
'capability_type' => 'post',

Choose a reason for hiding this comment

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

What: The show_in_rest parameter is added but there is no indication if the custom post type supports the necessary properties for REST API functionality.

Why: Ensuring that the custom post type is set up correctly for REST API interaction is crucial for both functionality and security. If it's not configured properly, it might lead to exposing data that should be restricted or failing to handle API requests correctly.

How: Verify that this custom post type has the required features enabled for REST API usage, such as supports for relevant fields like title, editor, etc. Additionally, consider defining the rest_base property if a custom endpoint is needed.

'show_in_menu' => false,
'show_in_nav_menus' => false,
'exclude_from_search' => true,
'capability_type' => 'post',

Choose a reason for hiding this comment

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

What: No validation or sanitization for the data being passed to the REST API is mentioned in the description.

Why: Not validating or sanitizing user input can lead to vulnerabilities such as SQL injection, XSS, or other forms of attacks, compromising the security of the application.

How: Ensure to implement validation and sanitization functions for any input being handled by the new API endpoints. Consider using WordPress functions like sanitize_text_field(), sanitize_email(), etc., to safeguard against malicious input.

'show_in_menu' => false,
'show_in_nav_menus' => false,
'exclude_from_search' => true,
'capability_type' => 'post',

Choose a reason for hiding this comment

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

What: Consider adding authentication checks for API requests to ensure only authorized users can access or manipulate the data.

Why: Without proper authentication, unauthorized users might access sensitive data or make changes to the system inappropriately, leading to data leaks or corruption.

How: Use WordPress functions such as current_user_can() to enforce permissions checking on your REST API endpoints, ensuring that only users with the correct capabilities can execute certain actions.

@@ -1 +1 @@
<?php return array('dependencies' => array('react', 'react-dom', 'wp-api-fetch', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => '4bfc9da33a23e2941d13');
<?php return array('dependencies' => array('react', 'react-dom', 'wp-api-fetch', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => '35dec36d1d208bf88914');

Choose a reason for hiding this comment

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

What: The version number appears to have been updated. Ensure that this reflects a meaningful change or optimization to your application.

Why: Updating the version number should indicate that key changes or improvements have occurred. This will help team members and users understand that there have been updates that may affect their experience or the functionality of the project.

How: Double-check the updated versioning scheme and ensure that it aligns with your project's versioning policy. If changes were made to dependencies that impact the application, document those changes accordingly in your changelog.

akshayurankar48 and others added 30 commits August 7, 2025 19:53
…dispaly-conditon Added select option in display condition
…on-issue Fixed extra post creation issue
Added security verification for all calls.
EPS-1554: Template Rename functionality
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants