Questions tagged [craft3]
For use with questions relating to the Craft 3 version of Craft CMS, including the Beta and RC releases.
111
questions
2
votes
2
answers
1k
views
Nested Entries in Craft 3
In Craft 2 there used to be a Nested Entries field, but this is not available in Craft 3.
I know I can do {parent.uri}/{slug} in the Entry URI Format field, but if I want it to be appended by ...
2
votes
1
answer
1k
views
Showing A Flash Message On Admin Entries Listing (Craft 3)
I've written a plugin that imports a CSV and creates entries from that for a client. I'm wanting to redirect them to the entries listing page after (i.e. /admin/entries/tvListings) and show a flash ...
2
votes
1
answer
481
views
EVENT_REGISTER_TABLE_ATTRIBUTES not working in Craft 3
I am developing a plugin to add custom column to entries table for which I am using EVENT_REGISTER_TABLE_ATTRIBUTES and EVENT_SET_TABLE_ATTRIBUTE_HTML and code example is:
Event::on(
Element::...
2
votes
1
answer
209
views
Getting unique values from Smart Map addresses
Using the following filter will return all the entries for 'CA'.
{% set params = {
filter: {
state: 'CA'
}
} %}
{% set meetings = craft.entries.address(params) %}
Let's say that I ...
2
votes
1
answer
437
views
Craft 3: how can I auto-redirect to a site version using the user IP?
I have set up multi-sites using several locales:
— International Website
— English
— Local Website
— French
— Dutch
— etc.
If the user has a French or Dutch IP, it should be auto-...
2
votes
1
answer
2k
views
CSRF in “Headless” Applications
There are a number of answers here about how to send CSRF tokens along with AJAX requests, but I think my question is a little different. Please excuse the abstractness here:
In a headless ...
2
votes
1
answer
456
views
baseUrl outputs environment variable
The newer versions of Craft CMS stimulate using environment variables in the CP. It works perfectly. I have set two variables for sites in my .env file:
DUTCH_SITE_URL="http://company.test"
...
2
votes
2
answers
283
views
Is it possible to allow logging at LEVEL_INFO without logging all the SQL queries?
We're currently logging our site at LEVEL_INFO to have a good idea of what's happening on the site. We find it useful, and appropriate, to log informational messages at that level rather than at ERROR ...
2
votes
1
answer
205
views
\ns\prefix\Plugin::getInstance() returns null from another plugin in Craft 3
I'm building a plugin that extends the functionality of the Contact Form Tuner plugin and customize the email recipients based on different scenarios. The email addresses need to be managed in the ...
2
votes
3
answers
371
views
Craft CMS/Feed Me slow performance
I am wondering if I have structured my data badly and was hoping someone could advise on an alternative. Essentially I have a structure with two types, a catalogue and the catalogues children. Some ...
2
votes
1
answer
180
views
How to return a hierarchical list of a site's page structure using the ElementAPI
I'm experimenting with using Craft in a headless way and am successfully using the Element API to return all the data required to show individual pages.
However, to be able to show sub navigation and ...
2
votes
1
answer
4k
views
"Failed to instantiate component or class" when calling Craft module
I created a module with the pluginfactory generator. The module is used for generating a zip file with all the files belonging to a project.
In the composer.json file, I added the following:
"...
2
votes
1
answer
364
views
Missing "Plugin Store" navigation on Craft 3 admin section
I am a newbie to CraftCMS and just installed my very first Craft Project on local Xampp. Everything looks good except the "Plugin Store" navigation menu is not showing up. Is there any trick or tweak ...
2
votes
1
answer
293
views
How to fetch only selected child category?
I have some parent and their child categories which has more than one child.
In an entry I have a category field where I selected a single child category (Bourbon) which is visible like so:
Now I ...
2
votes
1
answer
795
views
Understanding migrations and CLI commands
Can someone please help explain some basics regarding migrations and the associated CLI commands to help troubleshoot when things fail? Specifically,
How does craft know which migrations have been ...
2
votes
2
answers
2k
views
Error on Craft 3 install
When attempting to install Craft 3 in OSX El Cap, I'm getting the following errors:
Script @php craft setup/welcome handling the post-create-project-cmd event returned with error code 255
/Craft3/...
2
votes
3
answers
583
views
Including the category group in nested category URIs?
I've asked already about nested categories here, but I've just upgraded to Craft 3 and things seem to have changed a little.
I have three top-level category groups:
- Home
- About
- Funding
Each of ...
1
vote
1
answer
1k
views
Craft 3 Database Backup
Why do I have to activate the PHP functions: "proc_open" and "proc_close" to backup the database?
I got the error logs:
[error][yii\base\Exception] yii\base\Exception: Could not ...
1
vote
1
answer
700
views
Update checkbox value through plugin (Craft 3)
I'm trying to update a checkbox field of an entry through a plugin service. I tried two things:
Get the field values with $entry->fieldHandle->getOptions(), then manipulating the resulting ...
1
vote
1
answer
1k
views
Combining Multiple Relation
I am trying to accomplish targeting but wondering if there is a way to combine these two? I took a look around and in the Craft 3 docs but I am a bit turned around on this, really would appreciate ...
1
vote
1
answer
1k
views
Craft query Matrix blocks in twig
Is it possible to query elements of type MatrixBlock in Twig like other elements? You can get entries with
{% set entries = craft.entries.all() %}
Is there something similar available for Matrix ...
1
vote
1
answer
243
views
Match Matrix Fields Before Looping Through Results
I hope someone has an example or something similar they have done in Craft before. Her is what I have.
Structure:
Section -> Flight Company
Matrix Name -> Plane Details
Matrix Block: Plane Model ...
1
vote
2
answers
514
views
Parse variables into twig email template from custom module
I'm trying to send an email from my module and am trying to pass some vars into my module template that I can render using twig. Please note that this is a module template not a front end template.
$...
1
vote
1
answer
163
views
Error on functions in queue: “Session does not exist in a console request.”
I already experienced this same problem with Craft Commerce a while ago (Error on functions in queue: "Session does not exist in a console request.") and got a solution that solved the ...
1
vote
2
answers
1k
views
Load More Entries Button
I am trying to make my entry loop have a load more button, and not sure how to do it. I tried the method from http://craftsnippets.com/articles/infinite-scrolling-and-lazy-loading-with-craft-cms but I ...
1
vote
1
answer
59
views
Website transfer places /web in all urls, cs and js not loaded when moved up directory
I just transfered my website from one server to one.com. Now nothing works anymore cuz apparently one.com wants the index.php in the root directory but my index.php is in the "web" directory....
1
vote
1
answer
125
views
How to skip the first few entries in a "load more" scenario with Element API?
I have a website that uses a "load more" button. The process for this button can be found here:
http://craftsnippets.com/articles/infinite-scrolling-and-lazy-loading-with-craft-cms
I made it ...
1
vote
1
answer
729
views
Headless Live Preview with Gatsby
I am following Andrew Welch's post here - https://twitter.com/nystudio107/status/1168220713158942720?lang=en
I used the gatsby-config.js file he shared here - https://gist.github.com/monachilada/...
1
vote
3
answers
3k
views
Installing Craft 3 - Internal server error
Using Ampps on Windows, I'm trying to install a fresh Craft 3.0 and I've followed the steps and everything seems to be working. Until the very last step, where Craft says "Oops something went wrong". ...
1
vote
1
answer
62
views
Additional criteria to filter status of field passed into RelatedTo
I'm trying to save all the images related to an entry in a variable. I need the images that are added through a matrix field in the entry. I'm using the following code, but am then also getting images ...
1
vote
1
answer
91
views
For loop that can accept array and element query without throwing .all deprecation error
I have a component that accepts both hardcoded objects and entry queries. This allows us to have components that can be used independent of the database.
Hardcode include:
{% include '_components/...
1
vote
3
answers
2k
views
Show Entries based on content in a Matrix Field
I have a product with a variant matrix field(productVariants). Inside each variant is the option to supply a sale price (salePrice).
On the front end, I'm trying to show a product grid of only ...
1
vote
1
answer
2k
views
Craft CMS 3 admin panel returns 404 with SSL
I'm using MAMP Pro for local development and was gong to set up my site with SSL this time around. I got a self-signed cert for local dev and I can go to my development site over https:// without any ...
1
vote
0
answers
126
views
Element type vs. Field type - or: Element type without database storage?
I have already searched for information on this topic but I did not find much. I hope I did not overlook something.
My problem is the following: I want to try to write a plugin that lists entries ...
1
vote
2
answers
320
views
Dropdown field value getting outputted multiple times
I have a dropdown field that has three options. In my template, I want to do one thing if option 1 is selected and do something else if option 2 is selected.
Here is what my code looks like:
{% for ...
1
vote
1
answer
257
views
Excluding Array of Entry Ids Not Busting Cache
-- UPDATED --
My understanding of how the cache busting works is to make sure the query is within the {% cache %} tag. When looking into how it works I may not really be understanding the ins and ...
1
vote
1
answer
511
views
Output deprecation error
Good Evening,
Please bear with me I'm very new to Craft 3. I'm getting deprecation errors when outputting information.
I'm trying to output a single entry from a section using the following:
{% for ...
1
vote
1
answer
208
views
Sprout Forms Email
I have an entry where I select which form displays on the page. Is there a way for me on the entry using a text input for an email address to use that email address for the sending of emails via the ...
1
vote
1
answer
493
views
How to pragmatically set registered user status to pending and then manually send activation email
I have 2 front end registration forms. One for normal users and one for admins. In each form I have a hidden input with a group value like so:
<input type="hidden" name="group" value="ypo">
In ...
1
vote
0
answers
65
views
Looping over categories, product variants, and subsequently applying adjuster(s)?
Using the Craft 3 and Commerce 2 APIs, how would one go about looping through products in the cart to apply adjusters, looking at the following example;
A category, "Product Packs" is set up where ...
1
vote
1
answer
269
views
Ignoring "The " and "A " when sorting entries
I have this code which used to work with 2.x versions:
{% set foobars = craft.entries({ section: "foobars"}).order("(CASE WHEN title LIKE 'The %' THEN SUBSTRING(title, 5) WHEN title LIKE 'A %' THEN ...
1
vote
0
answers
257
views
Querying a supertable field
I have an entry type called people which has a superTable field called programmeAffiliations, with three fields, jobTitle, researchProgramme, primary where:
researchProgramme is a category field (...
1
vote
1
answer
2k
views
Solved: Unable to get composer running to install CraftCMS
for last weeks really I try to install composer, but it keeps complaining about SSL-problems. I searched everywhere on Google and found lots of people having the same problems, but for some reason ...
1
vote
1
answer
1k
views
Entries query by Super Table field
I have a section with a Super Table field, each "row" of which contains a date field. I am looking for a way to query for entries where one of the rows contains a future date.
1
vote
3
answers
2k
views
yii\web\ServerErrorHttpException Craft 3 install
I'm new with Craft CMS and receive this error when I try to install it
-------------------ERROR-----------------------------
An Error occurred while handling another error:
yii\web\...
1
vote
0
answers
377
views
How can I edit multiple entries via multiple front-end forms using Vue.js?
I found this post. However, writing a plugin in currently not an option, and I'd like to do this with Vue.js since I'm already using it for form validation & other stuff. Also, this involves ...
1
vote
1
answer
421
views
Craft 3 large log file sizes
I've noticed that Craft 3 log files in storage/logs e.g. web-404s.log and web.log don't seem to have a max size or rotate like with Craft 2.
The web-404s.log file is nearly 10 megs for 1 site now.
...
1
vote
1
answer
22
views
How do I get a list of checkboxes for the item addition form?
I know how to get a list of selected checkboxes for a entry:
{% for option in entry.myFieldHandle.options %}
Label: {{ option.label }}
Value: {{ option }} or {{ option.value }}
{% endfor %}
But I ...
1
vote
1
answer
161
views
Order by reverse relationship count
It feels like I’m trying to do the impossible, but I can’t imagine this problem is unique to my project. Hoping someone here has figured it out before!
I have two channels, creators and products, and ...
1
vote
1
answer
121
views
Can some one explain Event rules in plugins
So here is what I see in a controller:
$event->rules['cpActionTrigger1'] = 'plugin/default/do-something';
What does the first part 'cpActionTrigger1' refer to and what does the second part refer ...