Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
No related merge requests found
...@@ -443,6 +443,7 @@ const GLYPH_ICON_CLOSE = 'glyphicon-remove'; ...@@ -443,6 +443,7 @@ const GLYPH_ICON_CLOSE = 'glyphicon-remove';
// FORM // FORM
const F_NAME = 'name'; const F_NAME = 'name';
const F_TITLE = 'title';
const F_TABLE_NAME = 'tableName'; const F_TABLE_NAME = 'tableName';
const F_REQUIRED_PARAMETER = 'requiredParameter'; const F_REQUIRED_PARAMETER = 'requiredParameter';
const F_EXTRA_DELETE_FORM = 'extraDeleteForm'; const F_EXTRA_DELETE_FORM = 'extraDeleteForm';
......
...@@ -378,6 +378,8 @@ class QuickFormQuery { ...@@ -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, $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.'); [$formName], 'Form not found or multiple forms with the same name.');
$form = $this->modeAdjustFormConfig($mode, $form);
$this->formSpec = $this->eval->parseArray($form); $this->formSpec = $this->eval->parseArray($form);
HelperFormElement::explodeParameter($this->formSpec); HelperFormElement::explodeParameter($this->formSpec);
...@@ -495,6 +497,27 @@ class QuickFormQuery { ...@@ -495,6 +497,27 @@ class QuickFormQuery {
return $formName; 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. * Check if loading of the given form is permitted. If not, throw an exception.
* *
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment