Commit 297ed741 authored by Gerhard Killesreiter's avatar Gerhard Killesreiter

#58221, Turn #after_build into a functions array in order to make validation...

#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)
parent 4e9a12dd
......@@ -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(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment