Skip to content

Commit

Permalink
Merge 0392f1a into e08ee21
Browse files Browse the repository at this point in the history
  • Loading branch information
antonioribeiro committed May 26, 2021
2 parents e08ee21 + 0392f1a commit 301bfb2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Repositories/Behaviors/HandleBrowsers.php
Expand Up @@ -127,12 +127,12 @@ public function getFormFieldsForBrowser($object, $relation, $routePrefix = null,
* @param string $relation
* @return array
*/
public function getFormFieldsForRelatedBrowser($object, $relation)
public function getFormFieldsForRelatedBrowser($object, $relation, $titleKey = 'title')
{
return $object->getRelated($relation)->map(function ($relatedElement) {
return $object->getRelated($relation)->map(function ($relatedElement) use ($titleKey) {
return ($relatedElement != null) ? [
'id' => $relatedElement->id,
'name' => $relatedElement->titleInBrowser ?? $relatedElement->title,
'name' => $relatedElement->titleInBrowser ?? $relatedElement->$titleKey,
'endpointType' => $relatedElement->getMorphClass(),
] + (empty($relatedElement->adminEditUrl) ? [] : [
'edit' => $relatedElement->adminEditUrl,
Expand Down

0 comments on commit 301bfb2

Please sign in to comment.