verbb / hyper

A Craft CMS plugin for managing links, focusing on user experience.
Other
22 stars 14 forks source link

Check if Craft elements are enabled/disabled on 'isEmpty' #165

Closed ArnoMoqo closed 2 months ago

ArnoMoqo commented 4 months ago

What are you trying to do?

I would think when using link.isEmpty() Hyper would also check if the element is enabled. Right now, when you link to an entry, and you disable the entry there would still be an active Hyper link, linking to a 404 page since the page is no longer available.

What's your proposed solution?

Make link.isEmpty() return true when an disabled element is selected.

Additional context

Don't know if there are or gone be technical issues involved in this. Happy to discuss it.

engram-design commented 4 months ago

I tend to agree that linking to an element that isn't available seems odd behaviour. I suppose this is a somewhat breaking change, so keen to know if others have thoughts about the desired behaviour.

ArnoMoqo commented 4 months ago

I tend to agree that linking to an element that isn't available seems odd behaviour. I suppose this is a somewhat breaking change, so keen to know if others have thoughts about the desired behaviour.

Maybe adding a new property link.isEnabledcould also be a solution, than there is no breaking change for other users.

engram-design commented 2 months ago

Bit the bullet and just changed the behaviour of isEmpty for element links. To get this early, run composer require verbb/hyper:"dev-craft-4 as 1.1.32" or composer require verbb/hyper:"dev-craft-5 as 2.0.2".

engram-design commented 2 months ago

Updated in 1.2.0 and 2.0.3