- Issue created by @slucero
- last update
over 1 year ago 351 pass, 1 fail - @slucero opened merge request.
- last update
over 1 year ago 341 pass, 11 fail - last update
over 1 year ago 356 pass - last update
over 1 year ago 356 pass - Status changed to Needs review
over 1 year ago 3:08pm 18 May 2023 - last update
over 1 year ago 356 pass - last update
over 1 year ago 356 pass - 🇺🇸United States slucero Arkansas
I've uploaded an additional event subscriber within the
patternkit_test
submodule. This event subscriber tests during the update process to alter the "text" field value of the "@patternkit/atoms/example/src/example" pattern and append " (Altered)" to the existing value. WIth this enabled, manual testing to confirm the functionality should be easier.Since this module exists within the tests folder, the following will need to be added to the site's
settings.local.php
file:$settings['extension_discovery_scan_tests'] = TRUE;
After adding this, a cache clear should make the module available:
drush en -y patternkit_test
Now updating any patternkit block using the "@patternkit/atoms/example/src/example" pattern should also update the "text" field value as well.
- last update
over 1 year ago 356 pass - last update
over 1 year ago 356 pass - 🇮🇳India minsharm India
Tested the flow with an event subscriber which has been added by Stephen within the patternkit_test submodule. This event subscriber tests during the update process to alter the "text" field value of the "@patternkit/atoms/example/src/example" pattern and append " (Altered)" to the existing value.
Steps to retest -
1) Add the following line to the site's settings.local.php file:
$settings['extension_discovery_scan_tests'] = TRUE;
2) Enable the module using the below command:
drush en -y patternkit_test
3) Add "[Patternkit] Example" block and run the below query to force it to show as having an update available.
UPDATE pattern_revision
SET hash = 'ALTERED', version = 'OLD'
WHERE revision IN (
SELECT revision
FROM pattern
);3) Now update the above existing PK block using the "@patternkit/atoms/example/src/example" pattern.
Result : Updating the pattern has triggered the event and alter the content of the "Text" field.
Screenshots attached
- 🇺🇸United States slucero Arkansas
Since this has passed testing by a couple of people already, I'm going to go ahead and mark it as reviewed and merged in. I'd like to follow it up later with a supplementary issue to continue improving the developer experience in working with this. Example improvements could include:
- Add tools to ease debugging update failures
- Improved logging of validation failures with more context
- Option to bypass validation during content assignment? (Thinking about incremental updates spread across multiple event subscribers that may not validate on their own.)
- Add a base class for event subscribers to extend from
- Define a static run priority for the event that could be overridden on child implementations
- Implement the
getSubscribedEvents()
function such that inheritors don't have to uniquely define it - Add helper methods for common interactions with the event object
- Separate out methods for defining logic to determine if a specific event subscriber should be applied (test patterns and content matching rules)
- Add a typical method for applying transformations to content that could be applied at the top level pattern or any depth in the case of nested patterns
- Add documentation and examples for working with updates within nested patterns
- Add tools to ease debugging update failures
- Status changed to RTBC
over 1 year ago 7:24pm 5 July 2023 - last update
over 1 year ago 356 pass - last update
over 1 year ago 356 pass - Status changed to Fixed
over 1 year ago 7:27pm 5 July 2023 Automatically closed - issue fixed for 2 weeks with no activity.