Fix CRUD operations for sentiment management#21
Merged
Conversation
Resolves missing "Add sentiment" button and fixes multiple CRUD issues: - Add missing analyze_ai_sentiments.links.action.yml for "Add sentiment" button - Fix AISentimentsAnalyzer to use storage service instead of hardcoded defaults - Fix SentimentsSettingsForm data structure and form submission logic - Add default sentiment installation to hook_install() - Refactor storage service architecture for reliable CRUD operations - Fix variable naming conflicts in foreach loops that caused TypeErrors - Add data validation to prevent corrupted config issues 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Change SentimentsSettingsForm from ConfigFormBase to FormBase - Remove unused getEditableConfigNames() method - Remove unused TypedConfigManagerInterface and ConfigFactoryInterface dependencies - Simplify constructor and create() method - Form now uses storage service exclusively instead of Drupal config system This aligns with the custom storage service architecture and removes the architectural inconsistency of extending ConfigFormBase while not using parent form submission. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Fix undefined variable $sentiments -> $sentiment in AISentimentsAnalyzer - Remove invalid parent::buildForm() call after switching from ConfigFormBase to FormBase - Add proper form actions manually instead of relying on parent 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Shorten comment to comply with 80-character line limit. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes missing "Add sentiment" button and resolves multiple CRUD issues in the analyze_ai_sentiments module. This PR ensures reliable sentiment management functionality matching the architecture of sibling modules.
Issues Resolved
Closes #20
Changes Made
🎯 Core CRUD Fixes
analyze_ai_sentiments.links.action.ymlto register "Add sentiment" button🛠️ Technical Improvements
foreach ($sentiments as $id => $sentiments)TypeErrors throughout codebase📁 Files Changed
analyze_ai_sentiments.links.action.yml(new) - Action links for "Add sentiment" buttonanalyze_ai_sentiments.install- Added default sentiment installationsrc/Form/AddSentimentsForm.php- Fixed DI and variable namingsrc/Form/SentimentsSettingsForm.php- Fixed form structure and submissionsrc/Plugin/Analyze/AISentimentsAnalyzer.php- Use storage service consistentlysrc/Service/SentimentsStorageService.php- Enhanced validation and error handlingTest Plan
/admin/config/analyze/sentimentsloads without errors/node/*/analyzeworks without TypeErrorsArchitecture Notes
This PR standardizes the sentiment module to follow the same reliable storage service pattern used by the
analyze_ai_content_marketing_auditmodule, ensuring consistency across the analyze module family.Installation Impact
🤖 Generated with Claude Code