Problem/Motivation
Some research in #2931559: $sandwich_plugin_info should be passed by reference shows that we don't have a test that proves plugin_type_example_sandwich_info_alter() works.
Proposed resolution
- Convert
PluginTypeExampleTest::testPluginExample()to be a kernel test for speed's sake - Expand that kernel test to show that the alter hook is implemented correctly
Remaining tasks
User interface changes
API changes
Data model changes
Issue fork examples-2985705
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
avpadernoComment #5
avpadernoComment #6
oily commentedComment #7
avpadernoComment #8
avpadernoComment #9
avpadernohook_sandwich_info_alter()implementations will be invoked because the plugin manager for sandwich plugins has the following line in its class constructor.The argument passed to
hook_sandwich_info_alter()needs to be passed by reference because it is not an object; differently, any change done to that array would not be passed back to the code invokinghook_sandwich_info_alter(). That is how PHP works.A test to check that the definition of
plugin_type_example_sandwich_info_alter()will not be changed back tofunction plugin_type_example_sandwich_info_alter(&$sandwich_plugin_info)is not necessary.