updated core to 7.73

This commit is contained in:
2020-09-24 17:04:08 +02:00
parent 084d28842a
commit 7d87153100
524 changed files with 25194 additions and 7745 deletions
+160
View File
@@ -37,6 +37,13 @@ function form_test_menu() {
'access callback' => TRUE,
'type' => MENU_CALLBACK,
);
$items['form-test/validate-no-token'] = array(
'title' => 'Form validation without a CSRF token',
'page callback' => 'drupal_get_form',
'page arguments' => array('form_test_validate_no_token'),
'access callback' => TRUE,
'type' => MENU_CALLBACK,
);
$items['form-test/limit-validation-errors'] = array(
'title' => 'Form validation with some error suppression',
'page callback' => 'drupal_get_form',
@@ -90,6 +97,21 @@ function form_test_menu() {
'type' => MENU_CALLBACK,
);
$items['form_test/form-storage-legacy'] = array(
'title' => 'Emulate legacy AHAH-style ajax callback',
'page callback' => 'form_test_storage_legacy_handler',
'access arguments' => array('access content'),
'type' => MENU_CALLBACK,
);
$items['form_test/form-storage-page-cache'] = array(
'title' => 'Form storage with page cache test',
'page callback' => 'drupal_get_form',
'page arguments' => array('form_test_storage_page_cache_form'),
'access arguments' => array('access content'),
'type' => MENU_CALLBACK,
);
$items['form_test/wrapper-callback'] = array(
'title' => 'Form wrapper callback test',
'page callback' => 'form_test_wrapper_callback',
@@ -439,6 +461,27 @@ function form_test_validate_required_form_no_title_submit($form, &$form_state) {
drupal_set_message('The form_test_validate_required_form_no_title form was submitted successfully.');
}
/**
* Form builder for testing submission of a form without a CSRF token.
*/
function form_test_validate_no_token($form, &$form_state) {
$form['submit'] = array(
'#type' => 'submit',
'#value' => 'Save',
);
$form['#token'] = FALSE;
return $form;
}
/**
* Form submission handler for form_test_validate_no_token().
*/
function form_test_validate_no_token_submit($form, &$form_state) {
drupal_set_message('The form_test_validate_no_token form has been submitted successfully.');
}
/**
* Builds a simple form with a button triggering partial validation.
*/
@@ -574,11 +617,17 @@ function _form_test_tableselect_form_builder($form, $form_state, $element_proper
$form['tableselect'] = $element_properties;
$form['tableselect'] += array(
'#prefix' => '<div id="tableselect-wrapper">',
'#suffix' => '</div>',
'#type' => 'tableselect',
'#header' => $header,
'#options' => $options,
'#multiple' => FALSE,
'#empty' => t('Empty text.'),
'#ajax' => array(
'callback' => '_form_test_tableselect_ajax_callback',
'wrapper' => 'tableselect-wrapper',
),
);
$form['submit'] = array(
@@ -682,6 +731,13 @@ function _form_test_vertical_tabs_form($form, &$form_state) {
return $form;
}
/**
* Ajax callback that returns the form element.
*/
function _form_test_tableselect_ajax_callback($form, &$form_state) {
return $form['tableselect'];
}
/**
* A multistep form for testing the form storage.
*
@@ -746,9 +802,36 @@ function form_test_storage_form($form, &$form_state) {
$form_state['cache'] = TRUE;
}
if (isset($_REQUEST['immutable'])) {
$form_state['build_info']['immutable'] = TRUE;
}
return $form;
}
/**
* Emulate legacy AHAH-style ajax callback.
*
* Drupal 6 AHAH callbacks used to operate directly on forms retrieved using
* form_get_cache and stored using form_set_cache after manipulation. This
* callback helps testing whether form_set_cache prevents resaving of immutable
* forms.
*/
function form_test_storage_legacy_handler($form_build_id) {
$form_state = array();
$form = form_get_cache($form_build_id, $form_state);
drupal_json_output(array(
'form' => $form,
'form_state' => $form_state,
));
$form['#poisoned'] = TRUE;
$form_state['poisoned'] = TRUE;
form_set_cache($form_build_id, $form, $form_state);
}
/**
* Form element validation handler for 'value' element in form_test_storage_form().
*
@@ -785,6 +868,74 @@ function form_test_storage_form_submit($form, &$form_state) {
$form_state['redirect'] = 'node';
}
/**
* A simple form for testing form storage when page caching is enabled.
*/
function form_test_storage_page_cache_form($form, &$form_state) {
$form['title'] = array(
'#type' => 'textfield',
'#title' => 'Title',
'#required' => TRUE,
);
$form['test_build_id_old'] = array(
'#type' => 'item',
'#title' => 'Old build id',
'#markup' => 'No old build id',
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => 'Save',
);
$form['rebuild'] = array(
'#type' => 'submit',
'#value' => 'Rebuild',
'#submit' => array('form_test_storage_page_cache_rebuild'),
);
$form['#after_build'] = array('form_test_storage_page_cache_old_build_id');
$form_state['cache'] = TRUE;
return $form;
}
/**
* Form element #after_build callback: output the old form build-id.
*/
function form_test_storage_page_cache_old_build_id($form) {
if (isset($form['#build_id_old'])) {
$form['test_build_id_old']['#markup'] = check_plain($form['#build_id_old']);
}
return $form;
}
/**
* Form submit callback: Rebuild the form and continue.
*/
function form_test_storage_page_cache_rebuild($form, &$form_state) {
$form_state['rebuild'] = TRUE;
}
/**
* A simple form for testing form caching.
*/
function form_test_cache_form($form, &$form_state) {
$form['title'] = array(
'#type' => 'textfield',
'#title' => 'Title',
'#required' => TRUE,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => 'Save',
);
return $form;
}
/**
* A form for testing form labels and required marks.
*/
@@ -1548,6 +1699,15 @@ function form_test_programmatic_form($form, &$form_state) {
'#default_value' => array(1, 2),
);
// This is used to test that programmatic form submissions can bypass #access
// restrictions.
$form['textfield_no_access'] = array(
'#type' => 'textfield',
'#title' => 'Textfield no access',
'#default_value' => 'default value',
'#access' => FALSE,
);
$form['field_to_validate'] = array(
'#type' => 'radios',
'#title' => 'Field to validate (in the case of limited validation)',