Skip to content

Commit

Permalink
Fix ui seed merge in HasOneSql (#1047)
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek authored Aug 4, 2022
1 parent ac637ce commit dfcdf1c
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/Reference/HasOneSql.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,9 @@ public function addField(string $fieldName, string $theirFieldName = null, array
$defaults['enum'] ??= $refModelField->enum;
$defaults['values'] ??= $refModelField->values;
$defaults['caption'] ??= $refModelField->caption;
$defaults['ui'] ??= $refModelField->ui;
$defaults['ui'] = array_merge($defaults['ui'] ?? $refModelField->ui, ['editable' => false]);

$fieldExpression = $this->_addField($fieldName, false, $theirFieldName, array_merge_recursive([
'ui' => ['editable' => false],
], $defaults));
$fieldExpression = $this->_addField($fieldName, false, $theirFieldName, $defaults);

return $fieldExpression;
}
Expand Down Expand Up @@ -164,10 +162,9 @@ public function addTitle(array $defaults = []): SqlExpressionField

$fieldName = $defaults['field'] ?? preg_replace('~_(' . preg_quote($ourModel->id_field, '~') . '|id)$~', '', $this->link);

$fieldExpression = $this->_addField($fieldName, true, null, array_merge_recursive([
'type' => null,
'ui' => ['editable' => false, 'visible' => true],
], $defaults));
$defaults['ui'] = array_merge(['visible' => true], $defaults['ui'] ?? [], ['editable' => false]);

$fieldExpression = $this->_addField($fieldName, true, null, $defaults);

// set ID field as not visible in grid by default
if (!array_key_exists('visible', $this->getOurField()->ui)) {
Expand Down

0 comments on commit dfcdf1c

Please sign in to comment.