Skip to content

Fix/inspector config refactor#181

Merged
dermatz merged 8 commits intomainfrom
fix/inspector-config-refactor
May 7, 2026
Merged

Fix/inspector config refactor#181
dermatz merged 8 commits intomainfrom
fix/inspector-config-refactor

Conversation

@dermatz
Copy link
Copy Markdown
Member

@dermatz dermatz commented May 6, 2026

This pull request introduces a configurable "Toolbar Position" feature for the MageForge Inspector, allowing users to select where the toolbar appears on the page. The implementation includes backend configuration, frontend rendering, and styling updates. Additionally, configuration constants have been centralized for maintainability, and translation files have been updated for the new feature.

Toolbar Position Feature:

  • Added a new configuration option for "Toolbar Position" in system.xml and its default in config.xml, allowing users to choose between bottom-left, bottom-right, top-left, and top-right positions. (F898b67cR1, src/etc/config.xmlR14)
  • Implemented the ToolbarPosition source model to provide selectable options for the toolbar position in the admin configuration.
  • Updated the Inspector block (Inspector.php) and template (inspector.phtml) to read and output the configured position, defaulting to 'bottom-left' if unset. [1] [2]

Frontend Rendering & Styling:

  • Enhanced the toolbar's frontend JavaScript and CSS to respect the new data-position attribute, ensuring the toolbar and its menu appear correctly in all configured positions, including responsive adjustments. [1] [2] [3]

Configuration Refactoring:

  • Centralized all Inspector-related configuration paths and defaults in a new Inspector config class, replacing scattered string literals and constants throughout the codebase for easier maintenance and consistency. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13]

Translations:

  • Added translation entries for "Toolbar Position" and its options in both English and German CSV files. [1] [2]

Other Improvements:

  • Minor code cleanup in command and block classes for clarity and robustness, such as simplifying mode checks and updating match statements. [1] [2]

These changes collectively make the MageForge Inspector toolbar more flexible and easier to configure, while also improving code maintainability and user experience.

Copilot AI review requested due to automatic review settings May 6, 2026 22:03
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a configurable “Toolbar Position” option for the MageForge Inspector toolbar (admin configuration → frontend rendering), and refactors Inspector-related config paths/defaults into a centralized config class.

Changes:

  • Introduces an admin “Toolbar Position” select field (bottom-left/right, top-left/right) with defaults in config.xml.
  • Propagates the configured position to the frontend via data-position and adds CSS rules to position the toolbar/menu accordingly.
  • Centralizes Inspector config paths/default values in a new Model\Config\Inspector class and updates usages across PHP components.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/view/frontend/web/js/toolbar/ui.js Copies data-position from the root element onto the constructed toolbar container.
src/view/frontend/web/css/toolbar.css Adds position variants and menu anchoring rules for top/right placements (+ responsive tweaks).
src/view/frontend/templates/inspector.phtml Emits data-position on the toolbar root using the block’s configured value.
src/Model/TemplateEngine/Plugin/InspectorHints.php Uses centralized config path constants for inspector enablement checks.
src/Model/Config/Source/ToolbarPosition.php New source model providing position options for system config.
src/Model/Config/Inspector.php New centralized constants for Inspector config paths and defaults.
src/i18n/en_US.csv Adds translation strings for new config label/options (and related text).
src/i18n/de_DE.csv Adds German translations for new config label/options (and related text).
src/etc/config.xml Adds default mageforge/inspector/position value.
src/etc/adminhtml/system.xml Adds the new “Toolbar Position” select field to admin configuration.
src/Console/Command/Dev/InspectorCommand.php Switches to centralized config constant for enabling/disabling inspector.
src/Block/Inspector.php Reads theme/labels/position using centralized config constants and exposes getPosition().

Comment thread src/etc/adminhtml/system.xml Outdated
Comment thread src/view/frontend/web/css/toolbar.css
Comment thread src/i18n/en_US.csv Outdated
Comment thread src/i18n/de_DE.csv Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 6, 2026 22:16
Copilot AI and others added 2 commits May 6, 2026 22:16
…n field in system.xml

Agent-Logs-Url: https://github.com/OpenForgeProject/mageforge/sessions/5f83d607-c501-46ef-81b6-eb950da6237b

Co-authored-by: dermatz <6103201+dermatz@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.

Comment thread src/etc/adminhtml/system.xml
Comment thread src/i18n/en_US.csv
Comment thread src/i18n/de_DE.csv Outdated
Copilot AI and others added 2 commits May 6, 2026 22:20
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 6, 2026 22:20
Copilot finished work on behalf of dermatz May 6, 2026 22:21
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.

Comment thread src/view/frontend/web/css/toolbar.css
Comment thread src/i18n/en_US.csv
Comment thread src/etc/adminhtml/system.xml Outdated
…fields; fix en_US Show Button Labels default

Agent-Logs-Url: https://github.com/OpenForgeProject/mageforge/sessions/662a5940-af5f-45fe-ab1e-0ac89f1bb0f7

Co-authored-by: dermatz <6103201+dermatz@users.noreply.github.com>
Copilot finished work on behalf of dermatz May 6, 2026 22:27
@dermatz dermatz merged commit 410280d into main May 7, 2026
13 checks passed
@dermatz dermatz deleted the fix/inspector-config-refactor branch May 7, 2026 05:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants