We have a problem - InstallerController::activate() is capable of activating multiple projects in one shot, but it can only return feedback for one of them (the first one that returns a response).
The problem is that activators can return either nothing, or a complete response. That's too strong of an opinion. It also means we can never return an updated Project object to the frontend, with its post-activation information added to it, from the activate() method if an activator returns a response.
What we should do here is use the good ol' Drupal AJAX system for activation only. Activators should no longer be able to return full responses, but instead either an array of AJAX commands to add to a fuller AjaxResponse, or null (to add nothing to the response). That response should also include AJAX commands that wrap around the updated Project objects, so that those can be delivered coherently to the frontend.
As part of this change, we should split out ActivationManager::getActivationInfo() method into a dedicated normalizer that handles Project and ProjectsResultPage objects and turns them into data that can be consumed by the frontend. This would be a cleaner design for a few reasons:
- The job that getActivationInfo() is actually doing is normalization, so we might as well formally recognize that by moving it into a normalizer.
- Normalizers have an interface, which means that modules that wish to extend Project Browser could add more activation-related superpowers.
- Modules that want to swap out Project Browser's frontend entirely (which is an unlikely, but theoretically legitimate possibility) would be able to normalize Project objects in ways that make sense to them.
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | errors.png | 321.24 KB | chrisfromredfin |
Issue fork project_browser-3506454
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
phenaproximaComment #3
phenaproximaComment #6
phenaproximaComment #7
phenaproximaComment #10
chrisfromredfinhaving an issue installing the RDF module when max_selections == 1
Comment #11
chrisfromredfinj/k this didn't happen after a reinstall. I think my local was just a little messed up.
Comment #13
chrisfromredfinthis is way cool. two follow-ups adam is creating that are UI-related bugs when there's an error, but not directly caused by this code and those will be small, so prefer them in FUs.