- Issue created by @eiriksm
- π³π΄Norway eiriksm Norway
eiriksm β changed the visibility of the branch 3441006-make-it-possible to hidden.
- Status changed to Needs review
8 months ago 9:56am 15 April 2024 - π³π΄Norway eiriksm Norway
Pushed a very naΓ―ve implementation of it with no tests. Since there is no "API" to sort of manipulate from a form class to communicate to the form builder, I went for using the build info. Which you can control inside of a buildForm method like so, for example:
$build_info = $form_state->getBuildInfo(); $build_info[FormBuilder::SKIP_ALTER_FORM_ID] = TRUE; $form_state->setBuildInfo($build_info);
Would obviously need some tests, but setting to NR to get some feedback
- π³π΄Norway eiriksm Norway
I actually changed my mind, and added it to the form array instead, since I realized this would actually make it possible to alter base forms from custom code, that you would not want to alter the form_ids for, which can be convenient :)
- π³π΄Norway eiriksm Norway
If someone lands here wanting a solution, one way is to decorate the module handler with your own one, extending core.
Then, either via hardcoding it like this, or by somehow dynamically (hook_hook_info for example) indicate which implementations should be simply "discarded":
protected function getImplementationInfo($hook) { // Harcoded example. $form_id_prefix = 'form_commerce_order_item_add_to_cart_form_commerce_product_'; if (strpos($hook, $form_id_prefix) !== FALSE) { return []; } return parent::getImplementationInfo($hook); }
- Status changed to Needs work
8 months ago 12:53pm 15 April 2024 - π³π΄Norway eiriksm Norway
Of course.
At this point mostly interested if this makes sense to other people than me, but if I should read something into your comment I would say it currently does not seems like the opposite at least
- πΊπΈUnited States smustgrave
Maybe sub-maintainer can speak on it. Not sure I can help make the call.