Closed aerni closed 8 months ago
It actually looks like the issue is being caused by my own addon aerni/livewire-forms
. This addon also got an errors
tag. Wondering how I might solve this issue? Is there a way for both tags to co-exist with the same name? If not, I might be able to extend the tag that comes with Statamic? I tried to find it in the source but couldn't find the file.
No, you can't have two tags called the same thing. They'll conflict.
Yeah, that's what I thought. What's the best way to deal with this? Like what if you install two addons that both have a tag with the same name? There has to be a solution or not?
There's not really. Ideally addons shouldn't provide tags that could easily conflict with other addons, something like {{ addon_name:errors }}
Yeah, good point. So far I've been extending existing core tags to build on top of it if I needed to.
Anyhow, I actually figured, that the {{ errors:password }}
from my initial post is not a tag but a simple variable. I built a custom errors tag that is pretty much an Antlers version of the @error Blade directive. You can get all errors, count the errors,
see if an error exists, etc. I'm wondering if this is a good idea for a PR? Or maybe this is already possible without this new tag?
This is an example of how I'm using the tag:
{{ if {errors:any} }}
<p>{{ trans_choice key="There was an error with your submission:|There were :count errors with your submission:" count="{errors:count}" }}</p>
<ul>
{{ errors:all }}
<li>{{ error }}</li>
{{ /errors:all }}
</ul>
{{ /if }}
This might be related to @edalzell idea: https://github.com/statamic/ideas/issues/75
I'm going to close this issue now as it seems to have been sorted in the Livewire Forms addon - it doesn't include any tags anymore.
We don't recommend creating your own tags with the same names as core tags unless you're extending them otherwise you end up in situations like this.
Bug Description
I'm running into the following error when enabling password protection:
Call to undefined method password.
. I tracked it down to the following lines in the password view. The error disappears if you remove the tag.https://github.com/statamic/cms/blob/bd83fa907f25f04cac79fd267580044cb49a99f0/resources/views/auth/protect/password.antlers.html#L35-L37
How to Reproduce
'default' => 'password'
inconfig/protect.php
Environment
Statamic 3.1.27 Pro Laravel 8.50.0 PHP 7.4.20 aerni/livewire-forms 1.1.0 aryehraber/statamic-impersonator 2.2.0 doublethreedigital/duplicator 1.3.3 jonassiewertsen/statamic-livewire 2.6 spatie/statamic-responsive-images 2.7.1 visuellverstehen/statamic-classify 2.2.0 withcandour/aardvark-seo 2.0.14