Skip to content

Commit

Permalink
feat: tags in overview
Browse files Browse the repository at this point in the history
  • Loading branch information
64knl committed Apr 8, 2024
1 parent 48fab82 commit 9f033d5
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/Services/Assets/Components/ComponentTags.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Illuminate\Support\Facades\DB;
use NotFound\Framework\Services\Legacy\StatusColumn;
use NotFound\Layout\Elements\AbstractLayout;
use NotFound\Layout\Elements\Table\LayoutTableColumn;
use NotFound\Layout\Inputs\LayoutInputTags;

class ComponentTags extends AbstractComponent
Expand Down Expand Up @@ -72,6 +73,19 @@ public function getCurrentValue()
->get([$foreignTable.'.'.$p->foreignTagId.' AS id', $foreignTable.'.'.$p->foreignDisplayColumn.' AS label'])->toArray();
}

/**
* Gets the content for the table overview, this is usually a string.
*/
public function getTableOverviewContent(): LayoutTableColumn
{
// convert to array with only the value of the label
$values = collect($this->getCurrentValue())->map(function ($item) {
return $item->label;
});

return new LayoutTableColumn(implode(', ', $values->toArray()));
}

/**
* This function is for doing additional actions while saving, or - when not using the
* default storage mechanism - doing custom stuff.
Expand Down

0 comments on commit 9f033d5

Please sign in to comment.