- Run
composer require rias/statamic-link-it - Publish the assets with
php artisan vendor:publish --provider="Rias\LinkIt\ServiceProvider" - You're done!
Add the fieldtype to your fieldset by using the link_it handle. The most basic configuration is the following:
fields:
-
link:
handle: link
type: link_itContent editors can then choose from all the following types:
Containers
array - You have to define the asset containers in the field settings to use this type.
fields:
-
handle: link
field:
type: link_it
containers:
- documentsTaxonomies
array - You have to define the taxonomies in the field settings to use this type.
fields:
-
handle: link
field:
type: link_it
taxonomies:
- blog_categoriesCollections
array - You have to define the collections in the field settings to use this type.
fields:
-
handle: link
field:
type: link_it
collections:
- blogYou can configure which types are allowed by adding a types setting to your fieldtype.
This fieldtype supports the following settings. The default value is shown in the example.
bool - Whether this field is required
fields:
-
handle: link
field:
type: link_it
required: falsearray - A set of types which content managers can choose from.
fields:
-
handle: link
field:
type: link_it
types:
- asset
- entry
- custom
- email
- page
- term
- tel
- urlTo use the asset, entry and term types, please make sure you define the corresponding containers, collections and taxonomies settings.
object - Set default values, for example a default type.
fields:
-
handle: link
field:
type: link_it
default:
type: urlbool - Whether to give the choice to have links opened in a new window.
fields:
-
handle: link
field:
type: link_it
newWindow: falsebool - Whether to allow a custom link text. (For example "Read more")
fields:
-
handle: link
field:
type: link_it
text: falsebool - Whether to allow control over the aria-label.
fields:
-
handle: link
field:
type: link_it
aria: falsebool - Whether to allow control over the link title.
fields:
-
handle: link
field:
type: link_it
title: falsebool - Whether to allow users to append something to the url.
fields:
-
handle: link
field:
type: link_it
append: falseFor easy usage, LinkIt comes with a modifier to generate a link tag or extract the necessary information.
{{ link | linkIt }}
{{ link | linkIt:btn btn-link }}
{{ link | linkIt:target }}
{{ link | linkIt:text }}
{{ link | linkIt:prefix }}
{{ link | linkIt:url }}
{{ link | linkIt:title }}
{{ link | linkIt:aria }}
{{ link | linkIt:type }}










