Closed gfxdude-dus closed 5 years ago
How does your field look like in the .txt, and how would you like to have it displayed?
.txt: Category: Food, Sport, Nature
my idea is to render each value in its own span with its own class and style. trying to explode and split but can't get it to work.....lack of devskills :-/
You can try something like:
$categories = $field->split(',');
$wrappedCategories = array_map(function($category) {
return '<span class="category-label" data-category="'. $category .'">' . $category . '</span>';
}, $categories);
return implode('', $wrappedCategories);
Within the toLabel function? running into an error then: call to a member function split () at string
My bad, get rid of ->value
before split. Fixed above.
works like a charm now! thanks a lot!
is it possible that you give me a small hint on how to edit the field method for multi categories? thanks!