This package is an enhanced version of the original nikans/text-linked field with additional features:
- open links in new tabs / targets
- trim functionality with nova tooltip support
NB: The field is compatible to the original one, if you plan to change to this package you only have to update the imports.
Nova custom Text Field with a link to a resource (or any URL) on index screen.
Nova links ID fields to a resource by default. The custom field is useful if you're using a text ID field or want to link a resource's title, as shown below.
The field behaves just like the default text field on detail and form screens.
composer require lednerb/nova-text-linked-field
use Lednerb\TextLinked\TextLinked;
...
TextLinked::make('Title', 'title')
->link($this),
TextLinked::make('ID')
->link($this),
TextLinked::make('Title', 'title')
->linkResource($this->uriKey(), $this->id),
TextLinked::make('ID')
->url("https://novapackages.com"),
TextLinked::make('Title', 'title')
->link($this)
->openInNewTab(),
TextLinked::make('Title', 'title')
->link($this)
->openInNewTab('myTarget'),
TextLinked::make('Title', 'title')
->link($this)
->trim(), // Default are 50 chars
TextLinked::make('Title', 'title')
->link($this)
->trim(60),
By default a tooltip will be shown on hover state with the full untrimed value. If you don't want the tooltip, you can disable it as follows:
TextLinked::make('Title', 'title')
->link($this)
->trim()
->hideTooltip(),