MoritzLost
  • Member for 8 months
  • Last seen this week
1 answers
1 votes
29 views
Exception 'yii\base\UnknownMethodException'
1 votes

The problem is that this config file is for console commands as well as web requests. Console commands differ from web requests in that they don't have body parameters. For web requests, Craft::$app-&...

View answer
1 answers
0 votes
15 views
Given a global, how to get a particular language's version of it?
0 votes

I'd rethink that approach – if your users want to see the site in French, why are they seeing the site in English? And if they're viewing the English site, does it make sense to show an isolated piece ...

View answer
1 answers
1 votes
17 views
How to batch a large queue job?
1 votes

Remember that queue jobs are run in seperate processes from the code that enqueues them. So the 100 elements you're putting in the queue need to be serialized, saved to the database and then ...

View answer
1 answers
1 votes
35 views
Delete Parent and Children via the frontend
1 votes

Many of those advanced endpoints are undocumented, but you can find out a lot with the devtools. If you use the Delete (with Descendants) option in the backend and check the devtools, you can see it ...

View answer
2 answers
1 votes
26 views
image transform to webp image format
3 votes

If you're not seeing WebP as a format option, your server doesn't support webp. As per the server requirements for Craft, you need either of the PHP extensions for images, GD or ImageMagick. Both of ...

View answer
2 answers
1 votes
26 views
@webroot - how to find out path?
1 votes

You should specify the @webroot alias in your config/general.php. To make sure the path is always absolute and always correct for each environment, you can use the PHP function dirname() with the ...

View answer
2 answers
2 votes
22 views
How to customize fonts with redactor font menu
Accepted answer
2 votes

It's undocumented (like all Redactor plugins), but you can configure the list of fonts used in the JSON config you assign the Redactor field in the settings. You can download the original fontfamily ...

View answer
1 answers
1 votes
24 views
How does Craft CMS gets data from a 3rd part API?
Accepted answer
3 votes

Unless there's a community plugin specifically built for connecting to this API, you're gonna have to build your own. But a simple module to connect to a third-party API and get some basic data is not ...

View answer
2 answers
1 votes
48 views
`loop.last` throws 'variable is not defined when looping with a condition' error
Accepted answer
3 votes

Just to provide a slight improvement to @Matanya's solution: Instead of filtering the array of Neo blocks, you can limit your query to the blocks you actually want. This way, you're not loading blocks ...

View answer
1 answers
1 votes
26 views
Save metadata on entry without creating a corresponding field
Accepted answer
2 votes

I'm not sure there's a simple way to add metadata to entries without messing with the database or writing your own workaround. But if you only care about the value not being visible in the CP, you can ...

View answer
1 answers
1 votes
18 views
How can I see what fields changed on EVENT_BOEFORE_SAVE and or EVENT_AFTER_SAVE
Accepted answer
1 votes

You can use Element::getDirtyFields() and Element::getDirtyAttributes() to find which custom fields and which attributes (like authorId, postDate, etc) are marked as dirty (modified). Event::on( ...

View answer
1 answers
1 votes
23 views
How to save an entry using AJAX on a frontend Form [ for registered users]
Accepted answer
2 votes

As per the comments, the issue turned out to be that jQuery wasn't included on the page, so $ wasn't defined. In general, make sure to check the devtools console for error messages and use the ...

View answer
1 answers
1 votes
20 views
Set Session variable inside php controller
Accepted answer
1 votes

The Yii2 components behave a bit like singletons, you shouldn't create new ones manually. Instead, accessing them over the Craft::$app property is preferred, as you indicated. This should work: $...

View answer
1 answers
1 votes
17 views
upload base64 image -> save in assets -> custom plugin
2 votes

You need to create a Controller to handle the server-side saving of the image. The Controller should roughly perform the following steps: Receive and validate a POST request with the base64-encoded ...

View answer
1 answers
1 votes
36 views
Composer error while upgrading from Craft CMS 3.5.8 to 3.7.21
1 votes

Your composer.json indicates that the laravel/homestead package couldn't be found. This is strange, as the package does exist, even though you're requiring a heavily outdated version. Anyway, you can ...

View answer
1 answers
1 votes
28 views
How to make "Wheel Form" fields in JSON format using API
1 votes

You need to write a Twig template for the form and add it somewhere on your site. You can either add the form to an existing page or add a custom route for it. See the Wheel Form plugin documentation ...

View answer
1 answers
1 votes
36 views
Updating to 3.7.19 query
Accepted answer
1 votes

Running the query is not required – you can tell that by the version number. Craft doesn't use strict semantic versioning, but backwards incompatible changes are reserved for minor updates (a change ...

View answer
1 answers
1 votes
18 views
Query Entries only with postDate last of month
2 votes

You can use the LAST_DAY function if you're working with MySQL. To only get entries with a postDate on the last day of the month, you can check if LAST_DAY(postDate) is identical with DATE(postDate). {...

View answer
1 answers
1 votes
16 views
How do I add an import page to Craft CMS
Accepted answer
2 votes

A good place to put interfaces and tools that aren't super expansive or accessed very often is the Utilities section in the backend. Adding new utilities is very simple, you just add a class that ...

View answer
1 answers
2 votes
23 views
Using 'or' within query parameters
Accepted answer
1 votes

I had this exact same problem a while ago (calender view with a start date and an optional end date). I looked into how to combine multiple field filters with an OR-operator – as far as I can tell, it'...

View answer
1 answers
1 votes
20 views
Check for existing jobs in queue
1 votes

Yes, you can access the queue component using \Craft::$app->getQueue(). Keep in mind that this may return null or a non-compatible component depending on configuration, so make sure to check if the ...

View answer
2 answers
2 votes
28 views
How to get multiple image array using API or PHP query
1 votes

Edit: Previous answer was incorrect, see update below. What kind of field is infographics? How is it related to the infographicsImage field you're accessing in the loop? Either way, one of those is ...

View answer
1 answers
1 votes
53 views
DOM hash url in entry slug
2 votes

This is impossible (not only in Craft, but in general) because the fragment (hash, the part after the #) is only used on the client-side. This is by design, it's part of the spec that the fragment is ...

View answer
1 answers
1 votes
20 views
If a matrix field is set to "Only save blocks to the site they were created in", do the translation options for the sub-fields do anything?
Accepted answer
2 votes

Yes, you are correct. If you disable propagation, the blocks will only be saved for the site they are created in. So translations will never be visible anywhere. In order not to confuse users, I'd set ...

View answer
1 answers
1 votes
20 views
Find attributes in an object
3 votes

The entry variable is an instance of craft\elements\Entry. Most of the attributes you are going to be interested in are either properties of the class or customf fields. Class properties All entries ...

View answer
1 answers
1 votes
39 views
Remove duplicate text from query results
Accepted answer
2 votes

You might want to rethink your approach – any solution you build for this will break as soon as someone adds a new category that doesn't exactly match the naming pattern. In general, try to avoid ...

View answer
1 answers
0 votes
18 views
Discord Link dead?
1 votes

The link is correct, it works fine here: Make sure that the domain is not blocked on the network level and there isn't anything weird going on with your DNS settings. Maybe clear your browser cache ...

View answer
1 answers
1 votes
23 views
Customizing Field Layout / UI element in Craft Control Panel
Accepted answer
1 votes

The template will be rendered with an element variable which you can use to display fields and other properties of the given element. See the info displayed in the settings once you add it to the ...

View answer
1 answers
2 votes
22 views
How to show all files from a subfolder in craft Backend
1 votes

You can query for assets by using the craft.assets() query factory, see the documentation on Querying Assets for details. There are a couple of ways to narrow down a query. If the folder you mentioned ...

View answer
1 answers
1 votes
42 views
Contact form not working since Firefox version update
Accepted answer
2 votes

Not sure I have the full picture yet, but as per the comments, the problem appears to be clear: I think I found the issue. Before, I was disabling the form first and then submitting it. That was ...

View answer
1
2 3 4 5