Code Monkey home page Code Monkey logo

linkit's Introduction

FruitLinkIt plugin for Craft CMS Craft 2.5

One link field to replace them all, a multi-purpose link fieldtype for Craft CMS.

On Craft 3

Linkit for Craft 3 is now available in the Plugin Store (Linkit on GitHub)

Upgrading Pre 2.3.0?

See upgrade details below.

FruitLinkIt Overview

This plugin adds a fieldtype which links to all sorts of stuff, Link It can currently link to:

  • Entries
  • Assets
  • Categories
  • Products (Requires Commerce)
  • Emails
  • Phone numbers
  • Custom URLs

Link It supports Matrix fields and allows you to:

  • Configure what elements each field can link to.
  • Set which element sources are available to each field.
  • Allow fields to set custom link text.
  • Allow fields to set links to open in new window.
  • Set default link text.

Installation

To install FruitLinkIt, follow these steps:

  1. Download & unzip the file and place the fruitlinkit directory into your craft/plugins directory
  2. Install plugin in the Craft Control Panel under Settings > Plugins

FruitLinkIt requires Craft 2.5, for pre 2.5 support see releases.

Upgrading

Always ensure you have tested any new releases in a development environment.

Upgrading FruitLinkIt (Pre Version 2.3.0)

Upgrading from a version prior to 2.3.0 please take extra care to backup and test in a development environment. FruitLinkIt will run a migration that automatically updates any existing field settings and content after which it will remove the old version.

NB. Existing templates will not break but you will get a load of deprecator errors, take a look at the readme file for updated usage guides.

Configuring FruitLinkIt

Add a new Link It field and configure it. Easy.

Using FruitLinkIt

Template Variables (Basic Use)

Just output the custom field to get a ready built html link

{{ entry.linkItField }}

or in full

{{ entry.linkItField.htmlLink }} or {{ entry.linkItField.getHtmlLink() }}

Customised html link

{% set attributes = {
    title: 'Custom Title',
    target: '_self',
    class: 'my-class',
    "data-custom": 'custom-data-attribute'
} %}
{{ entry.linkItField.htmlLink(attributes) }}

Template Variables (Advanced Use)

Each Link it field returns a LinkIt model with the following attributes / methods available

{{ entry.linkItField.type }} (email, custom, tel, entry, category or asset)
{{ entry.linkItField.target }}
{{ entry.linkItField.url }} or {{ entry.linkItField.getUrl() }}
{{ entry.linkItField.text }} or {{ entry.linkItField.getText() }}

If your link is an element link (asset, entry, category) you also have access to the following:

{{ entry.linkItField.element }} or {{ entry.linkItField.getElement() }}

or specific element types

{{ entry.linkItField.entry }} or {{ entry.linkItField.getEntry() }}
{{ entry.linkItField.asset }} or {{ entry.linkItField.getAsset() }}
{{ entry.linkItField.category }} or {{ entry.linkItField.getCategory() }}

Deprecated Template Variables

{{ linkItField.linkText }} use {{ linkItField.text }} instead.
{{ linkItField.link }} use {{ linkItField }} or {{ linkItField.htmlLink }} instead.
{{ linkItField.email }} use {{ linkItField.url }} instead.
{{ linkItField.custom }} use {{ linkItField.url }} instead.
{{ linkItField.tel }} use {{ linkItField.url }} instead.

Hooks

There are two hooks that allow plugins to add their own Element Types to Link It:

linkit_registerElementTypes

Registers the ElementType(s) with LinkIt and provides all the data needed for the field settings.

It should return an array of element types you want to register and should be in the following format:

/**
 * @return array
 */
public function linkit_registerElementTypes()
{

  return array(
   'my_element' => array(
     'name'                   => Craft::t('My Element'),
     'pluralName'             => Craft::t('My Elements'),
     'selectionLabelDefault'  => Craft::t('Select an element'),
     'emptyInputErrorMessage' => Craft::t('Please select an element'),
     'elementType'            => 'MyPlugin_MyElement',
     'sources' => array(
       array(
         'label' => Craft::t('All of my elements'),
         'value' => '*'
       ),
       array(
         'label' => Craft::t('Element source 1'),
         'value' => 'myElementGroup:1'
       ),
       array(
         'label' => Craft::t('Element source 2'),
         'value' => 'myElementGroup:2'
       )
     )
   )
  ),
  'my_other_element' => array(
    ...
  );

}

linkit_getElementData

Fetches the element data for a given $type and $id:

/**
 * @param  string $type
 * @param  int    $id
 * @return array|false
 */
public function linkit_getElementData($type, $id)
{

  // Return false if there is no `$type` or `$id` set
  if (!$type || !$id) {
    return false;
  }

  switch ($type) {
    case 'my_element':
      $myElement = craft()->myPlugin_myElements->getMyElementById($id);

      if ($myElement) {
        return array(
          'url'     => $myElement->getUrl(),
          'text'    => $myElement->title,
          'element' => $myElement
        );
      } else {
        // There was no element, so be sure to return false
        return false;
      }
      break;

    case 'my_other_element':
      ...
      break;

    // We don’t want to return anything for unsupported types
    default:
      return false;
      break;
  }

}

FruitLinkIt Roadmap

Some things to do, and ideas for potential features:

  • Add front end template support
  • More validation options
  • Force download options
  • Improved cp field layout

FruitLinkIt Changelog

2.3.4

  • Added: Allow plugins to add their own Element Types (Thanks to Josh Angell)

2.3.3

  • Added: Support For Commerce Products (Thanks to Isaac Gray)

2.3.2

  • Fixed: Migration error when some settings values not defined.

2.3.1

  • Fixed: Target not retaining it's value

2.3.0

Complete rewrite for Craft 2.5.x, same functionality with some UI tweaks and

  • Improved: Now returns a custom validated link model to the template
  • Improved: Validation of the link model
  • Improved: Template usage - __toSting method now returns full html link
  • Improved: Field settings layout
  • Added: Facility to customise the html link attributes
  • Added: Fully translate Link It
  • Fixed: Locale settings bug

Amongst other stuff :)

1.0

  • Updated: Plugin renamed to bring it inline with the rest of our plugins.

0.9.1

  • Fixed: Input field not displaying correctly when set to single type when field had previously been saved.
  • Fixed: Custom text returning false.

0.9

  • Added: Removed the requirement to use the |raw filter when using the link variable.
  • Fixed: Input field now correctly displays when on one link type is setup.

0.8.1

  • Added: Hide the Link To... select when only one link type has been selected for the field.

0.8

  • Added: Category Support

0.7

  • Added: Default Text - Fieldtype setting to add default link text for a link.

0.6

  • Fix: PHP Error when returning an entry or asset that has subsequently been deleted

0.5

  • Initial beta release

Brought to you by Fruit Studios

Licence

Copyright 2014 Fruit Studios Ltd

linkit's People

Contributors

a-am avatar arandlett avatar dperrera avatar engram-design avatar johndwells avatar samhibberd avatar shornuk avatar swixpop avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

linkit's Issues

Custom Email Address Error

I'm getting an error ("Please enter a valid email address.") when entering a business email address into the email option for LinkIt. Does LinkIt's validation only validate standard email address (gmail, yahoo, etc.?) An example email address I'm trying to use is [email protected].

Translatable labels / placeholders

Can you please provide translatable options for /templates/_fieldtype/input.html in a next version?

Some examples:
placeholder: settings.defaultText == '' ? 'Custom Link Text' : settings.defaultText,

and
label: 'Open link in new window?',

It would be nice to simply add the |t function to make the values translatable:
label: 'Open link in new window?'|t,

Thanks in advance

Set custom text/html content via the htmlLink method?

I'm wanting to pass custom html in as the link content when using the htmlLink() template method.

I know I could handle the link manually in the template, but it seems like a waste when the htmlLink method is set up to handle all the possible link types already.

From looking at the LinkModel it seems this isn't currently possible, but I may be missing something.

So yeah it would be nice to be able to set the "customText" value when accessing it via the template. Passing it as an "attributes" value seems like the simplest option to me, but perhaps that's not the most logical and maybe another public method for setting it would be better?

I'll probably hack a solution into the LinkModel for my current project, unless you have a simple solution that I'm missing?

Thanks

Force download option.

How would you go about the force download option? Is that something you could achieve with twig {% header %} tags alone? I'm stumbling on how to include the raw contents of the file after the headers with twig...

{% header 'Content-Description: File Transfer' %}
{% header 'Content-Type: '~asset.mimetype %}
{% header 'Content-Disposition: attachment; filename='~asset.filename %}
{% header 'Content-Transfer-Encoding: binary' %}
{% header 'Expires: 0' %}
{% header 'Cache-Control: must-revalidate' %}
{% header 'Pragma: public' %}
{% header 'Content-Length: '.asset.size %}
{# Somehow print raw source of asset.filename #}

(Also, I swear I just stumbled upon this through a Google search, but so weird that we found each other's plugins on the same day and are each requesting features)

Access new window variable?

I am using Link It to output a URL for an image link but how do I output the target="_blank" for a link that I'm manually templating using the link URL? If it's not already built in somehow, I would love to be able to access entry.field.target and have it output _blank or _self based on what the user sets the option to.

Single option version doesn't display the field on a new entry

I can't get this to show the field if only one Link Type is selected, such as email.

I have made it work by adding the following code at line 23 of templates/_fieldtype/input.html:

  {% else %}

    {% if type is null %}
        {% for key,value in types %}
            {% set type = key %}
        {% endfor %}
    {% endif %}

    <input type="hidden" name="{{ name }}[type]" value="{{ type }}" />

This sets the type to the only valid type in the types array and therefor allows the field to be used, however it doesn't let you save the field empty.

I may be mis-using the plugin here but I basically want it to just validate an email field in this scenario and am using it elsewhere so didn't want to install a different plugin for just that purpose.

Remove dropdown when only single option available

Would be a great idea to remove (or hide) the dropdown box when only one option to select is available. For instance, if the user can only select Entries. I think it'd clean things up a little - but of course would need it there if more than one option.

screen shot 2015-02-21 at 12 48 07 am

Feature Request: Ability to add custom "custom URL" plain text field

It would be awesome if the plug-in allowed through an admin interface or a JSON config file for developers to add custom "custom URL" plain text links. For our use case it would be so we could rely on the same field to provide an asset OR a link to something like a SoundCloud track but it would expose that metadata as a link type - so that {{ entry.linkItField.type }} would return whatever the customized string would be.

Way to output "path" for entry links instead of full URL?

I proxy my local development environment through Codekit sometimes and I have a nav Structure outputting the main menu for me. My issue is that for entry links, the full URL is outputted. I would love a way to only output the "path" for the entry instead of the URL, otherwise when I click through my nav, it jumps me out of the proxy URL I use with Codekit and kicks me back to the main site URL. Hope that makes sense! :-)

Add support for more than 1 link

Hi,

First of all, thank you for your plugin. It solves a common issue that Craft has.

The only drawback compared to the built-in "entries" field is that LinkIt does not allow to add more than one link. It would be nice is, as of the built-in entries, you could enforce a limit, but allow to add more than 1 link.

Thanks!

Doesn't work when inside supertable inside matrix

Hello,

I have a supertable with a matrix inside of it and a Linkit field inside the matrix and when it's outputted on the template it is not a FruitLinkIt_LinkModel it's rendered as a Twig_Markup, basically it's completely empty (even if a URL is entered) and does not have any of the advanced templating parameters.

Somewhere along the line the supertable + matrix combo makes the Linkit field lose it's field type object and get rendered as a non field field (basically without a class).

I've not found the cause yet.

Field returning null

I've added a field, but when referencing in twig it's returning null, via {{ entry.cta }}. The field exists, but values don't see to be accessible. here's an inspection of the field:

Attributes: 
    columnPrefix         
    context              global
    groupId              4
    handle               cta
    id                   45
    instructions         
    name                 CTA
    oldHandle            
    required             
    settings             {"types":["custom","entry"],"defaultText":"","allowCustomText":"1","allowTarget":"1","entrySources":["singles","section:2","section:7","section:3"],"entrySelectionLabel":"Link to an page\/entry","assetSources":"*","assetSelectionLabel":"Link to an asset"}
    translatable         1
    type                 FruitLinkIt

Any ideas of what I might be missing? Thanks.

Update: I seem to be able to access the field in a matrix, but still not at entry root:

{% for action in entry.ctas %}
  {{ action.cta|inspect }}
{% endfor %}

Option to append parameters to an URL

It would be nice to have an option to append query string parameters and anchor names/ids to dynamically generated URLs (entries, assets etc.).

This is something, which popped-up on several projects and we don't have a solution yet.

Writing Plugin with linkit_registerElementTypes and linkit_getElementData

I'm having trouble understanding how to use the linkit_getElementData hook. Do you have an example plugin that uses it?

Specifically, I'm having trouble with the myPlugin_myElements bit in $myElement = craft()->myPlugin_myElements->getMyElementById($id);. Is myPlugin_myElements supposed to be my plugin's name? In that case, should I be implementing my own public getMyElementById method? Or how does it work? I keep running into Exceptions when I try to use it.

Open in new window not saving

Hi, thanks for this great plugin!

Just updated to the latest version and when clicking the "open in new window" checkbox and saving the entry, the option does not hold - i.e. entry.linkitfield.target is not set. Also when in the entry editor again, the checkbox will not be ticked.

Thanks in advance!
Dan

Custom URL requires http:// prefix or returns an invalid link

Expected behviour is surely not to create links like this if http prefix is not there
https://lhaseylotsawa.org/admin/entries/practiceTexts/www.dharmasun.org/tte

when:
www.dharmasun.org/tte

is the custom link field contents.

Possible solutions would be to automatically add the prefix (preferably otherwise I'll have to go through the entries by hand to invoke the corrected validation) or not allow it to be saved without.

At the moment I'm adding this to the description of the field which is not ideal.

If linking to an external site please include the full URL ie. http://website.com/ and not simply website.com

Link to categories

Is it possible to link to categories? (can't seem to find any reference to this functionality). If not how hard is it to add it please? I'd be happy to help with it :)

Release feed

It'd be great to have the plugin hooked up to a release feed to stay up to date with changes.

2.3 version update

We added the new fruitlink plugin folder to the craft plugins folder. The database shows the migration ran however the old version wasn't removed and the previous linkit inputs weren't updated to the new version. Did we miss a step in the update process?

Changing entry status removes link

I'm not sure if this has been asked yet, or if perhaps I'm missing something.

I've noticed that if an entry status is changed to inactive, this will remove the entry from any associated LinkIt fields.

If I later on change that entry back to active, to restore the link, I have to return to any associated LinkIt fields, and relink to that entry.

It would be ideal if status changes did not remove the link association.

Only showing 1 locales links

I've got a LinkIt field currently in a Matrix, then inside a SuperTable. When I go to choose an entry it only shows the entries for 1 locale. Weirdly, this locale it shows entries for isn't the one we're currently in, editing the entry.

I tried creating just a standard LinkIt field to see if Matrix or SuperTable was causing the issue but creating a field on it's own doesn't work.

Is there meant to be locale options here:

screen shot 2016-04-05 at 13 47 50

Am I missing something? I did update from version 0.9.1 of Linkit if this is any help.

Thanks

Call to a member function getClassHandle() on null

Current Install:

CraftCMS version: 2.6.2968
LinkIt version: 2.3.4

With this installed, and attempting to create or edit entries that use a LinkIt field type I am getting a internal server error of: Call to a member function getClassHandle() on null

The runtime logs show:

#17 /storage/av04327/www/craft/plugins/fruitlinkit/fieldtypes/FruitLinkItFieldType.php(136): Craft\TemplatesService->render('fruitlinkit/_fi...', Array)
#18 /storage/av04327/www/craft/app/vendor/twig/twig/lib/Twig/Template.php(615): Craft\FruitLinkItFieldType->getInputHtml('buttonLink', '')

How to make Link It do Breadcrumbs?

I have a site using a Structure section with a single Link It field for navigation. The field is called "navigationEntry" and links Entries, Assets and Categories. How can I get it to go breadcrumbs? It does not seem to work with relationships so how can I get this code below to work? It does not really output anything. What am I missing?

{% set bread = craft.entries.section('mainNavigation').relatedTo(entry.navigationEntry.entry).first %}

<nav class="breadcrubs">
    <ol class="breadcrumb">
        <li><a href="{{ siteUrl }}">Home</a></li>

        {% for crumb in bread.getAncestors %}
            <li>{{ crumb.navigationEntry.html }}</li> 
        {% endfor %}

        <li>{{ bread.title }}</li>

    </ol>
</nav>

Impossible to access an attribute on a boolean variable

Running LinkIt version 0.6 on Craft 2.1.2564. When trying to use any template variables (type, link, url, etc), I receive the following message (eg: url):

Impossible to access an attribute ("url") on a boolean variable ("")

I've tried using version 0.5 on Craft 2.1.2564 only to have the same result.

Running version 0.5 on Craft 2.0.2540 works fine.

Unable to link to "self" as in the entry being edited

I know this is a strange scenario, but in our case there's good reason... we have a LinkIt field set to link to a channel of entries, and then the field is assigned to the publishing layout of that channel. When editing an entry, and the LinkIt field opens up a modal to pick from entries in the channel, the existing entry is disabled and unavailable to select. Is that specifically by design, or just an inadvertent behaviour?

Exclude sections that don’t have URLs

Might it make sense to prevent selection of entries within sections that do not have URLs?

/**
 * Returns all sections that have URLs.
 *
 * @return array An array of Section instances
 */
public function getSectionsWithUrls()
{
    return array_filter(craft()->sections->allSections, function ($section) {
        return $section->isHomepage() || $section->urlFormat;
    });
}

Source

Labels and placeholders aren't translatable

Could you please take advantage of Craft's static translation support by running all text through "*|t" or Craft::t()? We see that some strings are translatable and other strings aren't.

Linkit is in English and we want to translate it to Dutch for a customer. Especially the select options (Email Address, Telephone Number, etc.) and field placeholders.

Thanks!

linkit field returning empty string (Craft 2.0)

Hi,

I'm attempting to create a navigation list using entries with a linkit field. Here is the template code I'm using:

{% set nav_entries = craft.entries.section('primaryNavigation').find() %}
<ul id="primary-nav">
    {% nav entry in nav_entries %}
        <li>
            {% set link = entry.navLink %}
            {% switch link.type %}
                {% case "entry" %}
                    <a href="{{ link.entry.url }}" {{ link.target ? ' target="_blank"' }} title="{{ entry.title }}">{{ entry.title }}</a>
                {% case "asset" %}
                    <a href="{{ link.asset.url }}" {{ link.target ? ' target="_blank"' }} title="{{ entry.title }}">{{ entry.title }}</a>      
                {% case "custom" %}
                    <a href="{{ link.custom }}" {{ link.target ? ' target="_blank"' }} title="{{ entry.title }}">{{ entry.title }}</a>
                {% case "email" %}
                    <a href="mailto:{{ link.email }}" title="{{ entry.title }}">{{ entry.title }}</a></p>
                {% case "tel" %}
                    <a href="tel:{{ link.tel }}" title="{{ entry.title }}">{{ entry.title }}</a></p>
            {% endswitch %}
            {% ifchildren %}
                <ul>
                    {% children %}
                </ul>
            {% endifchildren %}
        </li>
    {% endnav %}
</ul><!-- /#primary-nav -->

And I'm receiving the Twig error: "Impossible to access an attribute ("type") on a boolean variable ("")", highlighting the line "{% switch link.type %}".

Am I missing something? Could this be a compatibility issue with Craft 2.0?

Thanks! Looks like a great plugin by the way, if I can get it to work.

Error when CMS is running re-save entries task.

I keep getting this error in the phperrors log when Craft is running it's re-save entries task. It appears thhis stops the task from completing.
Call to a member function getUrl() on a non-object in Linkit_LinkitFieldType.php on line 384.
I am running Craft Pro 2.2.2588.

Make LinkIt extensible

LinkIt is awesome, we all know that.
What would make it more awesome? The ability to extend it with hooks/events.

This way, I could write a plugin extending LinkIt's types, say, specifically for handling YouTube/Vimeo/etc. urls. With that, I would be able to define how that changes the input when that type is selected, as well as the default output on the template side.

Let me know if you're interested in adding this functionality, or if you'd be willing to accept a PR with something like this.

Thanks!

Error if entry or asset is deleted & being linked to

Hey-

Noticed a small little bug. If an entry or asset is being linked to within linkit plugin and that element is deleted for whatever reason, rather than returning false or null it's throwing a php error.

On lines 381 & 396 (of the version I have at least) - you're doing a conditional to see if an ID is present. If you added an additional conditional to ensure the entry exists it'll fix the error & return the default fallback of false

Only output href

Is it possible to only put the href? I would like to do something like the following:

<a href="{{ cat.link.linkItField }}" class="categories__item__cta">

Alternatively is it possible to add the element as a wrapper?
Something like this:

{{ linkItField.beginningHere }}
	<div class="categories__item__background-wrapper">
		<img src="http://unsplash.it/500/500" alt="" class="categories__item__background" />
	</div>
	<div class="categories__item__button"><span class="standard">{{ cat.titel }}</span><span class="hover">Meer info</span></div>
	<div class="categories__item__overlay">
		<h2 class="categories__item__overlay__title title--stroked title--stroked--center">{{ cat.titel }}</h2>
		<div class="typography typography--light typography--14">
			<p>{{ cat.inhoud }}</p>
		</div>
	</div>
{{ linkItField.endHere }}

Error on localized site

Getting template errors (Impossible to access an attribute ("url") on a boolean variable ("")) while using this tag on the second language on a localized site. In my case my-domain.nl/en/

                        <a href="{{ link.url }}" {{ link.target ? ' target="_blank"' }} title="{{ link.linkText }}"
                            class="tp-caption sfb skewtotop btn btn-link"
                            data-x="{{ block.linkXPosition}}"
                            data-y="{{ block.linkYPosition}}"
                            data-speed="1000"
                            data-start="2000"
                            data-easing="Power4.easeOut"
                            data-endspeed="400"
                            data-endeasing="Power1.easeIn">
                            {{ link.linkText }} <i class="fa fa-angle-right"></i>
                        </a>

Edit LinkIt fieldtype values via front-end

I'm using the LinkIt field type for storing members custom URL's.

I want to allow members manage their custom URL's via the front-end in a profile update page.

Is it possible to edit LinkIt field values via the front-end?

Add "grid view" support

When trying to show the value of a linkit field in the entry list view a blank value is displayed instead of the value entered by the user, I tihnk it would be greatly beneficial if we added support for this.

Image for reference, the fields in the red box are LinkIt fields:
(In this case it is an email and a "phone" link)

Screenshot

Show Updates version in CP

I just realised that I'm at version 0.9.1 in this plugin. It would be nice I'f you could submit a update message in the Craft CP as other updates do…… Or am I so behind that this has already been implemented?

Entry LinkIt field not reading defined entries.

I'm able to select an entry, save the entry I'm in (saving the entry value I chose), but upon returning to the entry again, the field is cleared. This of course will not let me save due to validation.

image

Alignment issues

Has anyone else had the below issues with field alignments? Seems pretty messy? Did just upgrade from 0.9 to 2.3.2 successfully.

screen shot 2016-04-18 at 3 18 26 pm

I would imagine something like this is how it should look?

screen shot 2016-04-18 at 3 28 46 pm

Selection label

Are there any plans to support custom selection labels? Renaming from "Add an asset" to "Add an image" is a big help to UX.

Love the plugin. Thanks :)

Field returns error if left empty even though field is not required

Hi,

I'm having a issue with the following use case. I have LinkIt fields in a team members sections for optional external links to social media accounts. These are all optional and a number of the team members don't have social media accounts to link. However, it doesn't seem possible to save an entry even though the LinkIt field is not set to required.

Is there an alternative implementation for this use case?

linkItField.text defaults to linkItField.url

I think since the latest update the value of linkItField.text defaults to linkItField.url if no custom text is provided. I used to check if a text is provided to alter my html output.

Is this intended? Is there a way to check if there is a custom text provided?

URL not output for future or expired entries

When linking to an entry, the {{ entry.linkItField.url }} results in empty output if the chosen entry has a future post date or is expired.

When creating an event listing or archive listing I would think it should still output the entry url.

I was able to get by for now with a hacky twig workaround for now by checking for the related entry's url, but this is really not ideal:

{{ entry.linkItField.entry.getUrl()|default(entry.linkItField.url) }}

Craft 2.6.2952, LinkIt 2.3.4

Thanks for the awesome plugin and all your hard work!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.