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.
14 votes
2 answers
4k 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)
user avatar
11 votes
1 answer
4k 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 ...
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 ...
user avatar
  • 1,022
10 votes
7 answers
31k 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 ...
user avatar
  • 286
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 ...
user avatar
  • 917
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 ...
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....
user avatar
  • 419
8 votes
3 answers
2k 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 ...
user avatar
  • 23.6k
8 votes
3 answers
6k 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.
user avatar
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 ...
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 ...
user avatar
8 votes
2 answers
4k 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 ...
user avatar
  • 396
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(...
user avatar
  • 6,682
7 votes
2 answers
2k 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 ...
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 ...
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 ?
user avatar
7 votes
2 answers
1k 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/...
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 ...
user avatar
  • 407
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 ...
user avatar
  • 343
6 votes
4 answers
4k 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 ...
user avatar
6 votes
2 answers
865 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 ...
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 ...
user avatar
  • 305
6 votes
2 answers
937 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 ...
user avatar
6 votes
1 answer
101 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/...
user avatar
  • 438
6 votes
0 answers
540 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 ...
user avatar
5 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, ...
user avatar
  • 485
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 ...
user avatar
  • 284
5 votes
2 answers
4k 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 "...
user avatar
  • 1,032
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 ...
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 ...
user avatar
5 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.
user avatar
5 votes
2 answers
8k 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 ...
user avatar
5 votes
3 answers
1k 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->...
user avatar
  • 53
5 votes
3 answers
4k 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 ...
user avatar
  • 1,022
5 votes
1 answer
1k 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: ...
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 ...
user avatar
  • 1,273
5 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; // ...
user avatar
5 votes
1 answer
927 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 ...
user avatar
  • 2,265
5 votes
1 answer
2k 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?!
user avatar
  • 13.3k
5 votes
2 answers
2k 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 ...
user avatar
5 votes
1 answer
483 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 ...
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 ...
user avatar
  • 379
5 votes
1 answer
3k 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 ...
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 ...
user avatar
5 votes
0 answers
394 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 ...
user avatar
  • 1,731
5 votes
0 answers
386 views

How to load components into Craft 3 plugin?

what is the correct way to load third-party components into Craft 3 plugin I'm developing? I tried adding $this->setComponents([ 'authClientCollection' => [ 'class' => '\yii\...
user avatar
4 votes
5 answers
7k views

Craft 3 language switcher

Does anybody successfully implemented a language switch run Craft 3? Trying the Craft 2 variant slightly adjusted but still running into issues: Invalid site handle: nl <ul> {% set otherLocales ...
user avatar
4 votes
2 answers
3k views

How do you set a flash message in the template in Craft 3?

How does one set a flash message in the templates? I can't find any documentation about this, only for plugins or getting the message. My use-case is, I am checking if a user is allowed to access a ...
user avatar
4 votes
2 answers
514 views

Get array of titles instead of whole collection of entries' attributes

I know that to get the entries I can do: craft.entries.all() but instead of getting the whole collection of entries, I would like to get an array of titles from those entries (or any other field). ...
user avatar

1
2 3 4 5
37