Commit a9823b0f authored by Carsten  Rose's avatar Carsten Rose
Browse files

QuickFormQuery.php: Suppress renderinf of form title during a 'delete' call....

QuickFormQuery.php: Suppress renderinf of form title during a 'delete' call. No one will see and required parameters are not supplied.
parent de8e0783
......@@ -443,6 +443,7 @@ const GLYPH_ICON_CLOSE = 'glyphicon-remove';
// FORM
const F_NAME = 'name';
const F_TITLE = 'title';
const F_TABLE_NAME = 'tableName';
const F_REQUIRED_PARAMETER = 'requiredParameter';
const F_EXTRA_DELETE_FORM = 'extraDeleteForm';
......
......@@ -378,6 +378,8 @@ class QuickFormQuery {
$form = $this->db->sql("SELECT * FROM Form AS f WHERE f." . F_NAME . " LIKE ? AND f.deleted='no'", ROW_EXPECT_1,
[$formName], 'Form not found or multiple forms with the same name.');
$form = $this->modeAdjustFormConfig($mode, $form);
$this->formSpec = $this->eval->parseArray($form);
HelperFormElement::explodeParameter($this->formSpec);
......@@ -495,6 +497,27 @@ class QuickFormQuery {
return $formName;
}
/**
* Depending on $mode various formSpec fields might be adjusted.
* E.g.: the form title is not important during a delete.
*
* @param $mode
* @param array $form
* @return array
*/
private function modeAdjustFormConfig($mode, array $form) {
switch ($mode) {
case FORM_DELETE:
$form[F_TITLE] = '';
break;
default:
break;
}
return $form;
}
/**
* Check if loading of the given form is permitted. If not, throw an exception.
*
......
Supports Markdown
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