Skip to content

Commit

Permalink
Add descriptionFrom support for nested properties
Browse files Browse the repository at this point in the history
Adds support for JSON columns
descriptionFrom: name
descriptionFrom: json.name
descriptionFrom: json[name]
  • Loading branch information
AIC-BV authored May 16, 2024
1 parent f8459b4 commit 841ee8c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion modules/backend/formwidgets/RecordFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,12 @@ public function getDescriptionValue()
return null;
}

return $this->relationModel->{$this->descriptionFrom};
// Convert array-like notation to dot notation
if (preg_match('/\[(.*?)\]/', $this->relationModel, $matches)) {
$this->descriptionFrom = str_replace(['[', ']'], ['.', ''], $this->descriptionFrom);
}

return data_get($this->relationModel, $this->descriptionFrom);
}

public function onFindRecord()
Expand Down

0 comments on commit 841ee8c

Please sign in to comment.