#58221, Turn #after_build into a functions array in order to make validation of date fields possible. Patch by yched, tenrapid
Also makes forms API more consistent (see #pre_render)4.7.x
parent
4e9a12ddb8
commit
297ed741f8
|
@ -424,9 +424,12 @@ function form_builder($form_id, $form) {
|
|||
$count++;
|
||||
}
|
||||
|
||||
if (isset($form['#after_build']) && function_exists($form['#after_build']) && !isset($form['#after_build_done'])) {
|
||||
$function = $form['#after_build'];
|
||||
$form = $function($form, $form_values);
|
||||
if (isset($form['#after_build']) && !isset($form['#after_build_done'])) {
|
||||
foreach ($form['#after_build'] as $function) {
|
||||
if (function_exists($function)) {
|
||||
$form = $function($form, $form_values);
|
||||
}
|
||||
}
|
||||
$form['#after_build_done'] = TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -1355,7 +1355,7 @@ function comment_form($edit, $title = NULL) {
|
|||
}
|
||||
|
||||
if ($op == t('Preview comment')) {
|
||||
$form['#after_build'] = 'comment_form_add_preview';
|
||||
$form['#after_build'] = array('comment_form_add_preview');
|
||||
}
|
||||
|
||||
if ($_REQUEST['destination']) {
|
||||
|
|
|
@ -1355,7 +1355,7 @@ function comment_form($edit, $title = NULL) {
|
|||
}
|
||||
|
||||
if ($op == t('Preview comment')) {
|
||||
$form['#after_build'] = 'comment_form_add_preview';
|
||||
$form['#after_build'] = array('comment_form_add_preview');
|
||||
}
|
||||
|
||||
if ($_REQUEST['destination']) {
|
||||
|
|
|
@ -1651,7 +1651,7 @@ function node_form_array($node) {
|
|||
$form['delete'] = array('#type' => 'button', '#value' => t('Delete'), '#weight' => 50);
|
||||
}
|
||||
|
||||
$form['#after_build'] = 'node_form_add_preview';
|
||||
$form['#after_build'] = array('node_form_add_preview');
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
|
|
@ -1651,7 +1651,7 @@ function node_form_array($node) {
|
|||
$form['delete'] = array('#type' => 'button', '#value' => t('Delete'), '#weight' => 50);
|
||||
}
|
||||
|
||||
$form['#after_build'] = 'node_form_add_preview';
|
||||
$form['#after_build'] = array('node_form_add_preview');
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
|
|
@ -360,7 +360,7 @@ function system_view_general() {
|
|||
'#default_value' => file_directory_path(),
|
||||
'#maxlength' => 255,
|
||||
'#description' => t('A file system path where the files will be stored. This directory has to exist and be writable by Drupal. If the download method is set to public this directory has to be relative to Drupal installation directory, and be accessible over the web. When download method is set to private this directory should not be accessible over the web. Changing this location after the site has been in use will cause problems so only change this setting on an existing site if you know what you are doing.'),
|
||||
'#after_build' => 'system_check_directory',
|
||||
'#after_build' => array('system_check_directory'),
|
||||
);
|
||||
|
||||
$form['files']['file_directory_temp'] = array(
|
||||
|
@ -369,7 +369,7 @@ function system_view_general() {
|
|||
'#default_value' => file_directory_temp(),
|
||||
'#maxlength' => 255,
|
||||
'#description' => t('Location where uploaded files will be kept during previews. Relative paths will be resolved relative to the Drupal installation directory.'),
|
||||
'#after_build' => 'system_check_directory',
|
||||
'#after_build' => array('system_check_directory'),
|
||||
);
|
||||
|
||||
$form['files']['file_downloads'] = array(
|
||||
|
|
|
@ -360,7 +360,7 @@ function system_view_general() {
|
|||
'#default_value' => file_directory_path(),
|
||||
'#maxlength' => 255,
|
||||
'#description' => t('A file system path where the files will be stored. This directory has to exist and be writable by Drupal. If the download method is set to public this directory has to be relative to Drupal installation directory, and be accessible over the web. When download method is set to private this directory should not be accessible over the web. Changing this location after the site has been in use will cause problems so only change this setting on an existing site if you know what you are doing.'),
|
||||
'#after_build' => 'system_check_directory',
|
||||
'#after_build' => array('system_check_directory'),
|
||||
);
|
||||
|
||||
$form['files']['file_directory_temp'] = array(
|
||||
|
@ -369,7 +369,7 @@ function system_view_general() {
|
|||
'#default_value' => file_directory_temp(),
|
||||
'#maxlength' => 255,
|
||||
'#description' => t('Location where uploaded files will be kept during previews. Relative paths will be resolved relative to the Drupal installation directory.'),
|
||||
'#after_build' => 'system_check_directory',
|
||||
'#after_build' => array('system_check_directory'),
|
||||
);
|
||||
|
||||
$form['files']['file_downloads'] = array(
|
||||
|
|
Loading…
Reference in New Issue