Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [craft3]

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

1
vote
1answer
25 views

Good way to handle multisite fallback templates

So I've got a multisite going on. For most of the sites, most of the time, they'll be using the same templates. But I want a good way to handle siteX needing one template to be different from the ...
1
vote
2answers
26 views

How to upload a template in Craft CMS 3 on an Ubuntu web server

Really new to this platform and could use some help with how to upload a theme/template which I downloaded from ThemeForest. The files are compatible with HTML 5 and Craft 3 is on an Ubuntu server.
1
vote
1answer
8 views

Plugin CKEditor outputs something with nothing?

I have a problem with the CkEditor for Craft CMS. If I leave the textfield empty and save it, the output in the browser will still contain <p>&nbsp;</p> when I want it to be blank. I ...
2
votes
1answer
19 views

Call function from plugin in template

In craft 2 I had a simple plugin that I used to run some php code. I could call the function like this. {{ craft.pluginname.functionname }} However I have been unable to do the same thing in craft 3....
1
vote
0answers
19 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
1answer
8 views

Sprout Forms and Multi-site on Craft 3

Is it at all possible to get forms to display per site and not all forms displaying to a site admin user? Also an admin user doesn't seem to be able to run reports on there own site, without being an ...
1
vote
1answer
18 views

Craft subdomains

I am looking at creating an events site, and am thinking about using subdomains for each event. They will all be micro-sites listing exhibitors, timetables etc. I would like the domain structure to be ...
1
vote
1answer
18 views

Added custom entry details fields

I'm looking to add a custom fields to the details section on the right of the entry edit view in the control panel. I know that in Craft 2 this was possible using: Craft::$app->view->hook('cp....
0
votes
1answer
48 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 ...
1
vote
1answer
23 views

order by Table Number Field

% set entriesList = craft.entries.section('parks').relatedTo(entry.Line.one()).all %} {% if entriesList|length %} <div id="found-in" class="park"> <ul> {% for ...
1
vote
1answer
8 views

Unable able to update Freeform Pro from 2.2 to 2.5

I continue to get this error each time I try to update Freefrom. I don't was to alter the table structure since data exists.
1
vote
1answer
15 views

Closure in plugin class/ saving and passing a public property

I am struggling with closure and saving a variable. In my class somePlugin i do have a public var $customerId , which should be updated after i execute my setUser() function. To do so i have a setter ...
1
vote
1answer
21 views

Commerce 2 Stripe gateway seems to be working correctly, but order remains unpaid

I am using the Stripe gateway plugin for Commerce 2. I have done the following: Entered the stripe API keys correctly. Set the Webhook URL up correctly in Stripe. Correctly disabled CSRF protection ...
1
vote
2answers
24 views

Import database backup when using docker

I am trying to import a database backup into a craft instance running on Docker, but none of the fields or content from the latest backup are importing. Here are the steps I took I used these ...
0
votes
0answers
16 views

Craft 3: 500 Internal error when going to admin also Plugin Store page not found

I installed craft 3 CMS on my local machine. Install went ok. I FTP'd the file to my 1and1 server. I went through the install but then it said 'install failed check logs'. I went to my homepage and ...
1
vote
1answer
28 views

Pass Controller Variables into a Model

I am using a Controller to get Variables from a field in my Plugin. How and what would be the best way to pass and use them in other classes or my main plugin file. I thought about using Sessions or ...
0
votes
1answer
25 views

400 error on login

When I try to login to my admin area, I get this error: HTTP 400 - Bad Request - yii/web/BadRequestHttpException Unable to verify your data submission. The login button stays faded out, but it ...
0
votes
0answers
17 views

Create a helper class for the migrations

I created a class to abstract field creation with some default values while writing migrations. So far I tried creating a folder inside the migrations folder but when running the migration it can't ...
1
vote
1answer
20 views

Structure listing order & classes based on lightswitch value

I have a structure called "Projects", which I am currently listing on a page. The layout looks like the below - with the every row starting or finishing with a .wide class thumbnail: This is the code ...
1
vote
2answers
28 views

Action URLs from CP to a Craft 3 plugin controller

I'm working on my first Craft 3 plugin and want to add some buttons to my plugin's control panel section which post form data to a controller. My plugin is called 'myplugin', the controller I wish to ...
0
votes
0answers
52 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
2answers
26 views

Accessing Multiple Databases in Craft

Is there a way to access another database outside of the one Craft uses for its content? I need to able to access data fields from an external source for a project I'm working on.
1
vote
2answers
31 views

How can I set an entires status via ajax from a front-end form?

I am trying to set an entires status to disabled from a front-end form. Here is the click event listener I am using: $(document).on('click', '.delete', function (event) { let $this = $(event....
1
vote
1answer
11 views

Error running any Composer command

I am working on a project with multiple developers and another member of the team is getting on with a Plugin to assist with some CraftCommerce integrations. As it's not a publicly available plugin, ...
1
vote
1answer
39 views

Multi-Language Site but the Date should be always in English

with {{ block.timeLimit|date('M d Y H:i')}} i can get the real Date & Time in always the real Language from the Site. If the Page is German output is Dez, in English output is Dec. How can i set ...
1
vote
1answer
14 views

Saving a “craft-linkfield” field via an entry form

I'm editing an entry via an entry form as documented here: https://docs.craftcms.com/v3/dev/examples/entry-form.html How would I be able to save a link field that's using https://github.com/sebastian-...
1
vote
1answer
30 views

proc_open() has been disabled for security reasons

I'm trying to update Craft, but I'm getting an error while updating stating it's not possible to make a database backup. I've therefore gone for the suggestion to revert back instead of pushing on. ...
1
vote
1answer
26 views

How to store custom data into a user

I need some direction in how to store (complex) data into users (best practice) I'm working on a project for a fitness app. I created a structure with 2 levels for workouts where level 1 entries are ...
1
vote
1answer
22 views

craft-imageoptimize plugin cropping position

I am using imageoptimize plugin to crop images, but I am unable to find cropping position setup in a template. {% set optimzedImages = craft.imageOptimize.createOptimizedImages( entry....
1
vote
1answer
21 views

How to copy Matrix from one entry to another in Craft 3

I've got $entryA with a Matrix field. I want to programatically create a new $entryB and copy the Matrix field from $entryA to $entryB. How do I go about this?
1
vote
2answers
38 views

Does Craft have an equivalent of EE's Custom Fields loop for front-end entry forms?

We're in the process of scoping out an online assessment form to be build in Craft CMS. We need to give the client the ability to add, edit and remove questions (custom fields) and would ideally like ...
1
vote
0answers
16 views

Updating Field from plugin

So i'm trying to update a checkbox field using a custom plugin i built. I have three tiers on my site, tier one that you only get access to certain items, tier two you get access to tier one and other ...
0
votes
0answers
15 views

Update Checkbox on User fields

I'm trying to figure out how to update a checkbox field on my user backend from a plugin.
1
vote
1answer
23 views

Craft 3.1 Beta - Email settings and categories not working

I'm getting an "UnexpectedValueException" on the pages /admin/settings/categories/new and /admin/settings/email after updating to the beta.
0
votes
0answers
42 views

Craft behind NetworkPolicy/Firewall

I am putting Craft into a Kubernetes context with Calico enabled (NetworkPolicy) set as "block every connection but whitelist" for security matters. My environment is like that: Internet -> :80/:...
1
vote
1answer
34 views

Add settings to plugins cp section instead of settings page

I've setup a plugin like so http://domain/admin/plugin-handle (cp section) and a settings page here http://domain/admin/settings/plugins/plugin-handle I can edit my plugin settings under the latter ...
1
vote
2answers
14 views

How to include asset fields in query in php?

I am trying to figure out how to return asset field(s) in a PHP entry query. Also if I could learn how to return "custom fields" when returning an Object that would be great too! Right now I am having ...
1
vote
2answers
55 views

Saving Custom Field Values to User Profile

I have a custom user field 'myuserfield' How do I save a value to this field via a plugin in Craft3? Here is my current attempt. $myvar = '12345'; Craft::$app->getUser()->getIdentity()...
0
votes
0answers
20 views

Using asterix token in a routes file

Using a routes file in Craft 3 rather than the CP to manage routes. I need to to have an asterix token in my uri and have tried the following: 'users/*' => ['template' => 'users/_entry'] 'users/...
0
votes
0answers
21 views

EVENT_AFTER_SAVE_ELEMENT fires twice for some weird reason

Any idea why this code is always fired 2 times every time I save my entry? I get the same thing with Elements::EVENT_BEFORE_SAVE_ELEMENT (only for test purposes as I need to trigger AFTER), same thing ...
0
votes
0answers
15 views

Redactor + PurifyHTML: Add custom attribute to .json file

I am trying to edit the PurifyHTML settings in my Redactor plugin in Craft 3. I want to allow data-aos as an attribute on p elements. I created the appropriate file in config/htmlpurifier/, but I get ...
1
vote
1answer
13 views

Redactor - formattingAdd isn't changing code

I added a custom formattingAdd to my Standard.json file in my Redactor config. It's supposed to add the attribute data-aos="fade-right" to a paragraph tag. The "Animate" format option is showing up in ...
0
votes
0answers
23 views

Users public profile pages without routing

I am creating a membership/community based website and i want to users have public profile pages. I read other answer but i do not want to use Routing in this. Routing creates lots of SEO errors (bots ...
1
vote
2answers
38 views

How do I update a Craft website without losing data?

I have an existing website built with Craft CMS. I made a few changes locally and now I want to update the 'live' website. The problem is that I added a couple of fields and sections but I can't just ...
1
vote
0answers
24 views

Setting a new / override shippingAddress via axios

I am trying to change/set a customers shippingAddress via axios It does work e.g. for setting the shippingMethod or the quantity for a product. However if i want to set a new shippingAddress the ...
1
vote
1answer
28 views

Go from local to public with Craft 3

Is there a lesson/tutorial/docs about going from local to production on server with Craft 3? What files should be uploaded ( and which not ) What folders need to be one level up of the root - where ...
1
vote
1answer
19 views

How can I pass a variable defined in a Controller to my variables?

In my Craft 3 plugin I would like to pass a variable defined in my Controller to my PluginVariable.php file. Is this possible?
0
votes
0answers
18 views

Craft Commerce - Ability to create product options

We're hoping to develop a new ecommerce website for our client. They're a printing company (not the one referenced in the link). We'd like to develop on Craft Commerce but before we convince our ...
1
vote
0answers
28 views

Extending Craft Commerce Purchasable Nav Items

I'm looking to extend Craft Commerce with a custom Purchasable. I'd like to implement this using a module if possible. I've implemented the base class for my new Purchasable and that's all good. ...
0
votes
0answers
10 views

Duplicate products to subdomain

I can't find this anywhere so I'm going to assume it hasn't been asked. Is there a way to duplicate my products from my primary site to my subdomain? It seems like it should have done it ...