Quantcast
Viewing all articles
Browse latest Browse all 294798

ConfirmFormInterface::getFormName() serves no purpose in ConfirmFormBase

Problem/Motivation

ConfirmFormInterface::getFormName() is only called by ConfirmFormBase. The return value, a string, is used to build a hidden form element:

    $form[$this->getFormName()] = ['#type' => 'hidden', '#value' => 1];

The form value is not used by ConfirmFormBase's submit handler, although one subclass in core, UserMultipleCancelConfirm does check it.

However, because this form element uses the #value property, its value will ALWAYS be 1 according to the docs for Drupal\Core\Render\Element\Hidden:

 * - #value: The value of the form element. The Form API ensures that this
 *   value remains unchanged by the browser.

Therefore, AFAICT it doesn't serve any purpose and both the element and the ConfirmFormInterface::getFormName() could be removed.

Steps to reproduce

Proposed resolution

Remaining tasks

add deprecation. See how to deprecate for what needs to be done to add the deprecation.

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet


Viewing all articles
Browse latest Browse all 294798

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>