Commit 1c59a11d authored by Carsten  Rose's avatar Carsten Rose
Browse files

Merge branch '5876-subrecord-edit-delete-head' into 'master'

Feature #5876 - subrecordColumnTitleEdit/Delete

See merge request !61
parents e1b5c8ad 99e00c01
Pipeline #766 passed with stage
in 1 minute and 41 seconds
......@@ -3300,6 +3300,8 @@ will be rendered inside the form as a HTML table.
statements) might be used.
* *subrecordTableClass*: Optional. Default: 'table table-hover qfq-table-100'. If given, the default will be overwritten.
* *subrecordColumnTitleEdit*: Optional. Will be rendered as the column title for the new/edit column.
* *subrecordColumnTitleDelete*: Optional. Will be rendered as the column title for the delete column.
**Subrecord DragAndDrop**
......@@ -3821,7 +3823,7 @@ Parameter
* FormElement.type = subrecord
Subrecord's will automatically create `new`, `edit` and `delete` links. To inject parameter in those automatically created
links, use `FormElement.parameter.detail` . See `subrecord-option`.
links, use `FormElement.parameter.detail` . See subrecord-option_.
* FormElement.type = extra
......
......@@ -2337,14 +2337,14 @@ abstract class AbstractBuildForm {
/**
* @param string $linkNew Complete Button, incl. SIP href
* @param bool $flagDelete Flag to show if there is columns 'delete' rendered.
* @param string $deleteColumnTitle - if null, no delete column is rendered
* @param array $firstRow First row of all subrecords to extract columntitles
* @param array $control Array with <th> column names / format.
*
* @return string
* @throws UserFormException
*/
private function subrecordHead($linkNew, $flagDelete, array $firstRow, array &$control) {
private function subrecordHead($linkNew, $flagDelete, $deleteTitle, array $firstRow, array &$control) {
$columns = $linkNew;
......@@ -2357,7 +2357,7 @@ abstract class AbstractBuildForm {
}
if ($flagDelete) {
$columns .= '<th></th>';
$columns .= "<th>$deleteTitle</th>";
}
return Support::wrapTag('<thead><tr>', $columns);
......@@ -2407,7 +2407,9 @@ abstract class AbstractBuildForm {
$flagEdit = Support::findInSet(SUBRECORD_EDIT, $formElement[FE_SUBRECORD_OPTION]);
$flagDelete = Support::findInSet(SUBRECORD_DELETE, $formElement[FE_SUBRECORD_OPTION]) && ($formElement[FE_MODE] != FE_MODE_READONLY);
$linkNew = $flagNew ? Support::wrapTag('<th>', $this->createFormLink($formElement, 0, $primaryRecord, $this->symbol[SYMBOL_NEW], 'New')) : '<th></th>';
$editColumnTitle = $flagNew ? $this->createFormLink($formElement, 0, $primaryRecord, $this->symbol[SYMBOL_NEW], 'New') : '';
$editColumnTitle .= ' ' . $formElement[SUBRECORD_COLUMN_TITLE_EDIT];
$linkNew = Support::wrapTag('<th>', $editColumnTitle);
}
// Determine if DragAndDrop is active
......@@ -2436,7 +2438,7 @@ abstract class AbstractBuildForm {
}
$firstRow = isset($formElement[FE_SQL1][0]) ? $formElement[FE_SQL1][0] : array();
$htmlHead = $this->subrecordHead($linkNew, $flagDelete, $firstRow, $control);
$htmlHead = $this->subrecordHead($linkNew, $flagDelete, $formElement[SUBRECORD_COLUMN_TITLE_DELETE], $firstRow, $control);
$htmlBody = '';
foreach ($formElement[FE_SQL1] as $row) {
$rowHtml = '';
......
......@@ -754,6 +754,8 @@ const ALIGN_VERTICAL = 'vertical';
// Subrecord
const SUBRECORD_COLUMN_DEFAULT_MAX_LENGTH = 20;
const SUBRECORD_COLUMN_TITLE_EDIT = 'subrecordColumnTitleEdit';
const SUBRECORD_COLUMN_TITLE_DELETE = 'subrecordColumnTitleDelete';
const FORM_ELEMENTS_NATIVE = 'native';
const FORM_ELEMENTS_SUBRECORD = 'subrecord';
const FORM_ELEMENTS_NATIVE_SUBRECORD = 'native_subrecord';
......
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