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
2answers
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.
9
votes
3answers
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 ...
8
votes
1answer
2k 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 ...
8
votes
5answers
2k 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(...
7
votes
2answers
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 ...
7
votes
3answers
3k 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 ...
7
votes
5answers
2k 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 ...
7
votes
3answers
3k 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.
7
votes
2answers
1k 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 ...
7
votes
2answers
2k 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 ...
7
votes
3answers
3k 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 ...
6
votes
2answers
2k 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)
6
votes
1answer
2k 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 ...
6
votes
2answers
762 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....
6
votes
1answer
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 ?
6
votes
1answer
476 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/...
5
votes
2answers
3k 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 ...
5
votes
2answers
2k 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 ...
5
votes
3answers
654 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 ...
5
votes
4answers
3k 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 ...
5
votes
2answers
1k 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 ...
5
votes
0answers
266 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\...
4
votes
5answers
4k 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 ...
4
votes
7answers
747 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 ...
4
votes
2answers
1k 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, ...
4
votes
2answers
316 views

How long will it take Pixel and Tonic to release Craft 3?

I am just wondering, when will Pixel and Tonic release Craft 3 stable version?
4
votes
2answers
1k 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 ...
4
votes
3answers
742 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->...
4
votes
3answers
601 views

How do I “register” a service in a Craft 3 plugin?

In Craft 2, services were auto-loaded when using the craft()->plugin_serviceName->myMethodName() signature, but it seems like there's a catch in Craft 3, when using the new MyPlugin::getInstance(...
4
votes
1answer
1k views

Craft 3: Get Data from a custom Table via createCommand()

In Craft 2 you could creat a query with: craft()->db->createCommand()->select() .... etc. But in Craft 3 there is no select() Method in Craft::$app->db->createCommand(). Am I ...
4
votes
1answer
2k 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 ...
4
votes
2answers
296 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 ...
4
votes
1answer
4k views

Manual Plugin installation on Craft 3

I'm trying to manually install a plugin Pic Puller for Craft 3 Beta. My shared hosting won't allow enabling of allow_url_fopen so it can't be done via the plugin store within the dashboard. Any ...
4
votes
1answer
738 views

Craft 3 Multi-site with no “default” site

I have setup a Craft 3 multi-site with the following configuration: But what I really want is: Additionally, I want to have a 'default' http://localhost:8888 so I can always redirect to /en or /es ...
4
votes
2answers
2k views

Craft CMS 3.0 - Log file?

I've been playing around with Craft 3.0 and am just about to develop a site using it. First thing I see when testing my frontpage template is "Internal server error", styled as a Craft error box. So ...
4
votes
1answer
481 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 ...
4
votes
1answer
593 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: ...
4
votes
1answer
2k views

Set up Craft 3 when the craft folder is above public_html on shared hosting

I'm trying to setup Craft 3 on a shared host. It succeeds when I place all files in the public directory and then go to /web. But if I move the craft files to the folder /private_html/craft and the ...
4
votes
1answer
499 views

How can I check if a plugin is installed and enabled, in Craft 3?

In a question I asked a few years ago, it was very simple to perform a check on wether a plugin was installed or not. As of Craft 3, the same methods don't seem to work. The likes of this always ...
4
votes
1answer
187 views

Register JS files at the end of the body tag in the Control Panel

I would like to add my own external JS sources at the very end of the body tag in the Craft control panel. I've already tried using: {% do view.registerJsFile("<CDN_URL>", {position:3}) %} ...
4
votes
1answer
354 views

Issues upgrading Craft 2 to 3 - Keep seeing Install Screen not Update screen

I'm trying to update my development site on MAMP from Craft 2 to 3. I've installed Composer and tried both upgrade methods (keeping the current directory structure & using the new structure). But ...
4
votes
1answer
1k 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?!
4
votes
1answer
924 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 ...
4
votes
1answer
215 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 ...
4
votes
0answers
299 views

Craft 3 Custom Plugin: model validation

Struggling a bit here - have created a custom plugin where I want to validate form submission against a predefined model before saving to the database. All pretty straightforward so far … However, if ...
4
votes
0answers
731 views

How to handle Craft 3 events in a plugin? Element API is returning null data

The below refers to Craft 3 and the Element API plugin for Craft 3. I would like to do something when the Element API plugin fires its onBeforeSendData event, I can see in the controller for element ...
3
votes
2answers
4k 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 ...
3
votes
2answers
3k views

Craft 3 image asset getUrl() not showing

I came across an interesting issue. I'm using Craft CMS 3.0.0-RC14 and non of my image paths are showing but the title and the file name does. {% set image = nav.navLogo.one() %} {{image.title}} // ...
3
votes
2answers
286 views

How to access HTML input values from Twig and vice versa

I am new to Craft and Twig in general. I have encountered the following problems and struggling to find a solution for hours. I want to access the value of "foo" input field inside the twig ...
3
votes
2answers
94 views

Overriding isSystemOn setting for a single page

I have a staging site that has the isSystemOn set to false since I don't want people to stumble upon the site and be able to view content. I would like to have 1 page still "visible" though. This URL ...