3546723-refactor-configentity-to: Changing Entity Type for Content Reminders
3546723-refactor-configentity-to Implemented content entity content reminders and created a migration script
What was done:
Basically a ContentEntity type called ReminderEntity was created to work in conjunction along with the already existing ConfigEntity types called ContentReminder. Now a user can create new content reminders which will be Content Entity types. These will be stored in the reminder_entity database table. These content reminders can be edited and deleted as can the previously existing content reminders that are Config Entity types.
How was it done:
- Created ReminderEntityInterface
- extends ContentEntityInterface
- establishes entity fields
- Created ReminderEntity
- extends ContentEntityBase
- implements ReminderEntityInterface
- contains the class annotation definitions
- In content_reminders.schema.yml
- Define a schema for the Reminder Entity content entity
- Updated ContentReminder
- removed handler for the add form
- removed link for adding a content reminder
- Created ReminderEntity database schema in content_reminders.install
- In content_reminders.routing.yml
- created add, edit, preview, collection, and delete routes for ReminderEntity
- removed add route for ContentReminder
- moved collection listing from ContentReminderListBuilder to ContentReminderController
- will explain later.
- In content_reminders.links.action.yml
- Changed the route name of the add form to use the route defined in the ReminderEntity
- Created ReminderEntityForm
- handles editing of content reminders that are Content Entity types
- tried using one form for both Config and Content Entities but they underlying form processing
- handles both differently which created errors.
- Modified ContentReminderController
- Instead of creating two list builders to handle each entity type separately, created a build() function in the controller to list both types of entity types.
- In addition to the listing, functions were added to create the operations dropdown button on the table.
- Removed ContentReminderListBuilder
- since this can handle only one type of entity moved the list building responsibility over to ContentReminderController so both types of entities could be listed simultaneously.
- Modified ContentReminderService
- handles the edit form on the node edit page
- modified addReminderToEntityForm(), getContentReminderFor(), and handleFormSubmit() functions to handle both types of entities.
- Modified content_reminders.module
- modified content_reminders_cron() to handle both types of entities
- Created migration script migrate_configType_contentType
- converts existing ConfigEntity types to ContentEntity types
Closes #3546723