Questions tagged [craft3]

For use with questions relating to the Craft 3 version of Craft CMS, including the Beta and RC releases.

Filter by
Sorted by
Tagged with
16 votes
2 answers
2k views

Are there any plugins for Craft 3?

Are there any Craft 3 plugins yet? They would be useful as examples for porting/writing other Craft 3 plugins.
15 votes
2 answers
5k views

How to save Matrix data programmatically in Craft 3

How can you programmatically save an entry that has a Matrix field in Craft 3? (Something like this gist for Craft 2)
Brandon Kelly's user avatar
14 votes
7 answers
40k views

"Unknown package has no name defined" composer error on upgrade

Upgrading from Craft 3.4.20 running Composer 1.10.17 on PHP 7.2. Running ./craft update all returns the following error: error: Unknown package has no name defined. [followed by JSON object related to ...
Jason's user avatar
  • 326
11 votes
1 answer
5k views

{parent.uri}/{slug}

In Craft 2.x you have the option of setting the top-level entries URL format for a structure section separately from nested entries i.e. top-level/{slug} and {parent.uri}/{slug} But in Craft 3 the ...
Rich Hayler's user avatar
10 votes
3 answers
2k views

Craft CLI RC1 Connectivity Issues with MAMP Pro

I've been trying to run the new Craft CLI for the last couple of versions without any success. I figured maybe since we weren't at RC1 yet that it wasn't fully working. After seeing Ryan's video about ...
Tim Knight's user avatar
  • 1,022
10 votes
3 answers
7k views

Plugin logging in Craft 3

How is logging handled in Craft 3? There's nothing mentioned in the docs at all. None of the below exist. Craft::log() MyPlugin::log() MyPlugin::$plugin->log() I'm not seeing any logging in any of ...
JamesNZ's user avatar
  • 927
9 votes
3 answers
1k views

New Project: Wait for Craft 3 or start now with Craft 2?

I am just about to start a new project and Craft seems the best fit as a CMS. The projects timescale is 3 months. I understand that a beta for Craft 3 is due out at the end of this year (2016). In ...
Luke Clifton's user avatar
9 votes
2 answers
3k views

Events documentation for Craft 3

I've been looking for an Event Reference doc for Craft 3 just like what we had for Craft 2, but couldn't find one. The only events doc I found for Craft 3 is the plugin updating guide: https://docs....
Wei's user avatar
  • 459
9 votes
3 answers
7k views

Craft 3: how to show the Yii Debug Toolbar?

I'm using Craft 3 RC and I am logged as an admin. How can I display the Yii debug toolbar on front-end and Control Panel requests? By default, I don't see this toolbar.
Romain Poirier's user avatar
8 votes
3 answers
3k views

Craft 3 plugins - Logging in a separate *.log file

In Craft 2, it was possible to have your plugin log to a separate file. For example, it would record items to a myplugin.log file. You would simply be able to do it like this... MyPlugin::log('Lorem ...
Lindsey D's user avatar
  • 23.9k
8 votes
5 answers
3k views

Has someone figured out Craft 3 content migrations?

One of the big features for craft 3 is content migrations. Migrating fields and sections between environments (like deploying code to test or production). I'm just having a hard time figuring out what ...
Roel's user avatar
  • 148
8 votes
2 answers
3k views

How to handle the SECURITY_KEY?

1) Where To Put It I’m wondering how I should proceed with the SECURITY_KEY which is now mandatory in Craft 3 (RC2). It has to be the same for one project, right? So it should be shared across ...
medoingthings's user avatar
8 votes
2 answers
5k views

How to link to controller actions in a Craft 3 plugin?

I cannot find any documentation that specifies how to link to controller actions which return a rendered template in CP. Let's say I have a plugin called waffles and my namespace is Very\Waffles. I ...
Gustavs's user avatar
  • 406
8 votes
5 answers
3k views

How do you set a user's group on a registration form?

In a registration form with public signup possible, how do you set the user group for a particular form? As a stop-gap I am attempting to use the following code: function init() { craft()->on(...
Luke Holder's user avatar
  • 6,767
7 votes
2 answers
3k views

How do I upload an asset in Craft 3, via PHP

I've found various answers on how to upload assets via PHP for Craft 2, however nothing for Craft 3. All answers use the method: craft()->assets->insertFileByLocalPath() E.g: How to upload an ...
SteveEdson's user avatar
7 votes
3 answers
5k views

Multi-site setup in Craft3

Hi guys are the any more detailed tutorials on how to setup a multi site on Craft3 BETA? I created two sites now, a Danish and English through the admin (Settings → Sites). The domain is the same but ...
trustkool's user avatar
7 votes
1 answer
2k views

How to set up multi-env in Craft 3 with .env files?

How do I take advantage of the new .env files? I want to setup a local and production environment in Craft 3. Anyone know how to do this or know of any docs out there explaining it ?
Payton Burdette's user avatar
7 votes
2 answers
2k views

How to setup assets in multi site where each site should have its own assets?

I have a setup with multi sites that are separate domains. site-a.com site-b.com I would also like to have assets separate for each site, like so: site-a.com/images/picture1.jpg site-b.com/...
EyOwrH's user avatar
  • 143
6 votes
7 answers
3k views

Invalid plugin: No plugin exists with the handle - Craft 3

I had an issue with my site running Craft 3.1.15 where I wasn't able to update the site to the most recent 3.1.16, and also wasn't able to install any plugins. Every plugin I tried would throw this ...
Amy's user avatar
  • 407
6 votes
2 answers
3k views

User events in Craft 3

How do I capture user events in Craft 3? I looked at the documentation but couldn't figure it out. I need to capture after user registration events and after user save events. Here is what I tried, ...
Branko's user avatar
  • 495
6 votes
2 answers
3k views

Is there a way to apply project.yaml changes on deployment?

Love the new new project config functionality, but if there are changes that need to be synchronised the site essentially goes down until the changes are applied manually. I wondered if anyone had a ...
Daniel's user avatar
  • 343
6 votes
4 answers
5k views

Craft 3 Command setup failing

I've installed Craft 3 through composer and I'm attempting to work through the setup process within terminal: MacBook-Pro:~ jamie$ ~/Documents/repos/__craft-3-beta/craft setup Which database driver ...
Spacecentre's user avatar
6 votes
1 answer
2k views

How to fetch entries in custom plugin Craft 3?

I am creating custom search based on entries. I need to fetch entries in custom plugin.
Kantesh Hotchandani's user avatar
6 votes
2 answers
1k views

How to delete tags in Craft CMS 3

I want to delete some of the tags that are entered in the system. Since there is no way to do that in Control Panel, and there is not a valid plugin that can do this (know that from my previous ...
Ivaylo Petrov's user avatar
6 votes
1 answer
1k views

Can't get setFieldValue to work

I've got this // Creating users through frontend Event::on(Users::class, Users::EVENT_BEFORE_ACTIVATE_USER, function(UserEvent $event) { $userId = $event->user->id; // ...
Stian Karlsen's user avatar
6 votes
1 answer
2k views

Running module migrations

I must be missing something or not understanding something. I'm trying to build a module for an install, and I'd like to run the initial migration. So the module initial install migration for the DB ...
jrothafer's user avatar
  • 305
6 votes
2 answers
1k views

How do I prevent secrets beeing logged in the PHP error log?

Background: I'm running Craft Pro 3.1.19 on PHP 7.2.15 Craft CMS, by default, uses vlucas/phpdotenv to get the configuration (containing secrets / credentials and lots of other stuff) from .env ...
Knut Erik's user avatar
6 votes
1 answer
510 views

Search weighting

Is there a way to control the weighting of certain fields in Craft when using search in the front-end? I have a Products Channel which I am trying to search against and I want to be able to boost ...
Cole Henley's user avatar
  • 1,741
6 votes
1 answer
623 views

Autocomplete for Visual Studio Code for plugin development

How to achieve autocompletion for Craft 3 for PHP inside Visual Studio Code? I mean, what is required (like installing PHP locally, folder structure etc.) if at all possible? I assume many people who ...
Eternal Black's user avatar
6 votes
1 answer
113 views

Import Stripe subscriptions into Commerce 3

Is there a straight-forward way to import Stripe subscriptions into Commerce 3? I had hoped FeedMe or similar would do it, but it seems not: https://github.com/craftcms/feed-me/issues/472 Any help/...
iamkeir's user avatar
  • 458
5 votes
2 answers
4k views

Craft 3 RC Upgrade killed the WYSIWYG Editor

I just finished upgrading to Craft 3 RC and all text on the site is gone. The WYSIWYG Editor has been replaced with this message: Unable to find component class 'craft\fields\RichText'. What can I ...
TRIM's user avatar
  • 304
5 votes
3 answers
5k views

"Craft isn't installed yet" error after updating to Craft 3.1

I just updated to Craft 3.1 and logged into the admin to make the required updates to the database and this all worked fine. However, when I use the new ./craft update CLI feature, it responds with "...
Jay's user avatar
  • 1,042
5 votes
2 answers
2k views

EVENT_AFTER_SAVE_ELEMENT triggered twice after saving an entry

I had this weird issue, not sure if that happens to you guys or not. I'm trying to catch the 'after entry is saved' event, using the following code in my custom module's init() function (The module's ...
Wei's user avatar
  • 459
5 votes
2 answers
3k views

How to add locales in Craft 3

I'm getting started with Craft, using version 3 beta, and I don't find the menu option for adding locales so I guess it's not yet ready but there must be another option. Could anyone guide me through ...
Rosana Ruiz's user avatar
5 votes
3 answers
1k views

Private plugin distribution in Craft CMS 3

what is the best way to install private plugin in Craft CMS 3? The private plugin is installed in private GitHub repo, but we don't have a custom packagist that we would use, therefore I wonder if ...
PeterBocan's user avatar
5 votes
2 answers
9k views

Craft 3: how can I set dynamic Base URL in sites setting?

Sites localized versions are setup using Base URL like this: — http://{baseUrl}/en/ — http://{baseUrl}/fr/ But {baseUrl} variables are not transformed using craft.app.sites.getAllSites(). {% set ...
Romain Poirier's user avatar
5 votes
3 answers
2k views

How to render a Twig template in the element-api plugin (v2.5)

I want to render a Twig template in an API endpoint. Specifically I need HTML for the JSON Feed field "content_html". My attempts until now (inside the transformer function): $view = Craft::$app->...
zauni's user avatar
  • 53
5 votes
3 answers
5k views

Setting the Homepage URL in Craft 3

This seems like an odd question, but I've looked through the documentation, Slack, and the StackExchange and it's weird that I'm not seeing anything... so I feel like I'm overcomplicating it. How do ...
Tim Knight's user avatar
  • 1,022
5 votes
1 answer
2k views

Craft 3 Multi Category and Field Search

Looking for the solution to searching entries in one section that are related to multiple categories and match number field criteria. This is for a used auto website. Categories: Make/Model/Trim: ...
Chattervast's user avatar
5 votes
1 answer
5k views

Cannot declare class because the name is already in use

I'm trying to port a Craft 2 plugin to Craft 3, and don't seem smart enough to work out the namespaces. I've stripped out everything except what the docs recommend, but keep getting Cannot declare ...
kr37's user avatar
  • 1,293
5 votes
1 answer
1k views

Uncaught TypeError Dotenv Create on updating to Craft CMS 4

Just updated to Craft 4, migrated my /web folder over as well as my /assets folder and trying to load the index page gives me the following error. Any help would be great as I can no longer access my /...
JMKelley's user avatar
  • 1,324
5 votes
1 answer
502 views

Only allow SVG as file type

I want to have an asset field which only allows .svgs. To be more specific, I want to upload icons I can later import in my templates via the svg() command. Is this possible without any plugins or a ...
user11054's user avatar
5 votes
1 answer
993 views

How can I install modules with Composer?

Installing a Craft 3 plugin via Composer is pretty simple. You require the package, update Composer, and install it via the CMS. My circumstances require that our company use a private Module on all ...
Mark Notton's user avatar
  • 2,315
5 votes
1 answer
3k views

Unable to locate message source for category ''

I'm trying to update my plugin to Craft 3 and I'm getting this error message: Unable to locate message source for category ''. What does it mean?!
Ben Parizek's user avatar
  • 13.4k
5 votes
1 answer
67 views

Identify event origin (e.g. via admin vs module code)?

When using Craft Event triggers in PHP (e.g. Event::on), is there any event metadata that can tell where the event originated from? E.g. if it was triggered from an admin action, or if it was ...
iamkeir's user avatar
  • 458
5 votes
2 answers
3k views

Sendmail not working on Craft 3

I'm building my first Craft 3 site, and having problems getting email to send. I've set it to use Sendmail but when I click the Test button in the CP, I get "There was an error testing your email ...
Frank Harrison's user avatar
5 votes
1 answer
538 views

Update Asset Index in Migration

I'm trying to index some asset volumes that I'm creating in a migration. These are local volumes which may already contain files. I'm hoping to avoid the step where I have to manually update the ...
Piaras Hoban's user avatar
5 votes
2 answers
2k views

Craft 3 404 and 503 pages in devMode

Is there any way to get Craft 3 to display 404.html and 503.html for the 404 and 503 pages while in devMode, as it did in Craft 2, rather than returning the entire Yii 2 error stack? Sometimes, we ...
Dustin C's user avatar
  • 379
5 votes
1 answer
4k views

How to route to a controller action in Craft3?

Before I get tagged as a duplicate I have already tried everything in the 'duplicate' issues on here to no avail so I'm posting my exact config to see what I'm doing wrong. Here is my plugin code and ...
Rick Kukiela's user avatar
5 votes
2 answers
3k views

Craft 3 Plugin Routing Problems

So I am working on converting a previously-standalone Yii 2 app into a Craft module and am having some issues with routing. I wish to keep my old URL structure as much as possible. As such, I ...
Justin Cherniak's user avatar

1
2 3 4 5
39