Skip to content

Commit

Permalink
Merge pull request #5691 from Laravel-Backpack/pass-column-subfields-…
Browse files Browse the repository at this point in the history
…through-guessing-functions

pass column subfields through guessing functions
  • Loading branch information
pxpm authored Oct 15, 2024
2 parents 8a06a85 + 04a7b73 commit ac35070
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/app/Library/CrudPanel/CrudColumn.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,25 @@ public function upload($upload = true)
return $this->save();
}

/**
* When subfields are defined, pass them through the guessing function
* so that they have label, relationship attributes, etc.
*
* @param array $subfields Subfield definition array
* @return self
*/
public function subfields($subfields)
{
$callAttributeMacro = ! isset($this->attributes['subfields']);
$this->attributes['subfields'] = $subfields;
$this->attributes = $this->crud()->makeSureColumnHasNeededAttributes($this->attributes);
if ($callAttributeMacro) {
$this->callRegisteredAttributeMacros();
}

return $this->save();
}

/**
* Make the current column the first one in the columns list.
*
Expand Down

0 comments on commit ac35070

Please sign in to comment.