Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: tags in overview #231

Merged
merged 1 commit into from
Apr 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading