Issue #2355001 by ashutoshsngh, dinarcon, er.pushpinderrana: Remove form.inc form_builder().
parent
a9f0c068cb
commit
e8d6588e14
|
@ -2541,7 +2541,8 @@ function drupal_prepare_page($page) {
|
|||
* the defaults for this type of element, defined in hook_element_info(),
|
||||
* are merged into the array. #defaults_loaded is set by functions that
|
||||
* process render arrays and call element_info() before passing the array to
|
||||
* drupal_render(), such as form_builder() in the Form API.
|
||||
* drupal_render(), such as \Drupal::formBuilder()->doBuildForm() in the
|
||||
* Form API.
|
||||
* - If this element has an array of #pre_render functions defined, they are
|
||||
* called sequentially to modify the element before rendering. After all the
|
||||
* #pre_render functions have been called, #printed is checked a second time
|
||||
|
|
|
@ -84,18 +84,6 @@ function form_execute_handlers($type, &$form, FormStateInterface $form_state) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds and processes all elements in the structured form array.
|
||||
*
|
||||
* @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0.
|
||||
* Use \Drupal::formBuilder()->doBuildForm().
|
||||
*
|
||||
* @see \Drupal\Core\Form\FormBuilderInterface::doBuildForm().
|
||||
*/
|
||||
function form_builder($form_id, &$element, FormStateInterface $form_state) {
|
||||
return \Drupal::formBuilder()->doBuildForm($form_id, $element, $form_state);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes internal Form API elements and buttons from submitted form values.
|
||||
*
|
||||
|
@ -520,7 +508,8 @@ function template_preprocess_form_element(&$variables) {
|
|||
$element = &$variables['element'];
|
||||
|
||||
// This function is invoked as theme wrapper, but the rendered form element
|
||||
// may not necessarily have been processed by form_builder().
|
||||
// may not necessarily have been processed by
|
||||
// \Drupal::formBuilder()->doBuildForm().
|
||||
$element += array(
|
||||
'#title_display' => 'before',
|
||||
);
|
||||
|
|
|
@ -1147,8 +1147,8 @@ class FormState implements FormStateInterface {
|
|||
->unsetValue('op');
|
||||
|
||||
// Remove button values.
|
||||
// form_builder() collects all button elements in a form. We remove the button
|
||||
// value separately for each button element.
|
||||
// \Drupal::formBuilder()->doBuildForm() collects all button elements in a
|
||||
// form. We remove the button value separately for each button element.
|
||||
foreach ($this->getButtons() as $button) {
|
||||
// Remove this button's value from the submitted form values by finding
|
||||
// the value corresponding to this button.
|
||||
|
|
|
@ -35,7 +35,7 @@ abstract class RenderElement extends PluginBase implements ElementInterface {
|
|||
}
|
||||
// This function is invoked from form element theme functions, but the
|
||||
// rendered form element may not necessarily have been processed by
|
||||
// form_builder().
|
||||
// \Drupal::formBuilder()->doBuildForm().
|
||||
if (!empty($element['#required'])) {
|
||||
$element['#attributes']['class'][] = 'required';
|
||||
$element['#attributes']['required'] = 'required';
|
||||
|
|
|
@ -1493,9 +1493,9 @@ function template_preprocess_file_managed_file(&$variables) {
|
|||
* Upload controls are hidden when a file is already uploaded. Remove controls
|
||||
* are hidden when there is no file attached. Controls are hidden here instead
|
||||
* of in file_managed_file_process(), because #access for these buttons depends
|
||||
* on the managed_file element's #value. See the documentation of form_builder()
|
||||
* for more detailed information about the relationship between #process,
|
||||
* #value, and #access.
|
||||
* on the managed_file element's #value. See the documentation of
|
||||
* \Drupal::formBuilder()->doBuildForm() for more detailed information about the
|
||||
* relationship between #process, #value, and #access.
|
||||
*
|
||||
* Because #access is set here, it affects display only and does not prevent
|
||||
* JavaScript or other untrusted code from submitting the form as though access
|
||||
|
|
|
@ -76,12 +76,12 @@ class TextFormat extends RenderElement {
|
|||
// Ensure that children appear as subkeys of this element.
|
||||
$element['#tree'] = TRUE;
|
||||
$blacklist = array(
|
||||
// Make form_builder() regenerate child properties.
|
||||
// Make \Drupal::formBuilder()->doBuildForm() regenerate child properties.
|
||||
'#parents',
|
||||
'#id',
|
||||
'#name',
|
||||
// Do not copy this #process function to prevent form_builder() from
|
||||
// recursing infinitely.
|
||||
// Do not copy this #process function to prevent
|
||||
// \Drupal::formBuilder()->doBuildForm() from recursing infinitely.
|
||||
'#process',
|
||||
// Description is handled by theme_text_format_wrapper().
|
||||
'#description',
|
||||
|
|
|
@ -26,7 +26,8 @@ class RenderWebTest extends WebTestBase {
|
|||
public static $modules = array('common_test');
|
||||
|
||||
/**
|
||||
* Tests rendering form elements without passing through form_builder().
|
||||
* Tests rendering form elements without passing through
|
||||
* \Drupal::formBuilder()->doBuildForm().
|
||||
*/
|
||||
function testDrupalRenderFormElements() {
|
||||
// Define a series of form elements.
|
||||
|
|
|
@ -137,11 +137,11 @@ function views_ui_add_limited_validation($element, FormStateInterface $form_stat
|
|||
$element['#limit_validation_errors'] = array($ajax_triggering_element['#parents']);
|
||||
|
||||
// If we are in the process of a form submission and this is the button that
|
||||
// was clicked, the form API workflow in form_builder() will have already
|
||||
// copied it to $form_state->getTriggeringElement() before our #process
|
||||
// function is run. So we need to make the same modifications in $form_state
|
||||
// as we did to the element itself, to ensure that #limit_validation_errors
|
||||
// will actually be set in the correct place.
|
||||
// was clicked, the form API workflow in \Drupal::formBuilder()->doBuildForm()
|
||||
// will have already copied it to $form_state->getTriggeringElement() before
|
||||
// our #process function is run. So we need to make the same modifications in
|
||||
// $form_state as we did to the element itself, to ensure that
|
||||
// #limit_validation_errors will actually be set in the correct place.
|
||||
$clicked_button = &$form_state->getTriggeringElement();
|
||||
if ($clicked_button && $clicked_button['#name'] == $element['#name'] && $clicked_button['#value'] == $element['#value']) {
|
||||
$clicked_button['#limit_validation_errors'] = $element['#limit_validation_errors'];
|
||||
|
|
|
@ -1156,7 +1156,8 @@ class ViewEditForm extends ViewFormBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Recursively adds microweights to a render array, similar to what form_builder() does for forms.
|
||||
* Recursively adds microweights to a render array, similar to what
|
||||
* \Drupal::formBuilder()->doBuildForm() does for forms.
|
||||
*
|
||||
* @todo Submit a core patch to fix drupal_render() to do this, so that all
|
||||
* render arrays automatically preserve array insertion order, as forms do.
|
||||
|
|
Loading…
Reference in New Issue