Questions tagged [craft3]

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

278 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
5
votes
0answers
267 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
0answers
303 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
732 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
0answers
266 views

Mailer config in Craft 3 not getting merged

I have this custom config in config/app.php, but Craft seems to keep using the default Control panel Sendmail config. It seems this doesn't get merged in the main.php file. (as promised) return [ '...
2
votes
0answers
42 views

How to wire html template to twig extension? (Mainly `Twig\Error\SyntaxError: Unknown filter Error`)

I am going to use a Twig filter function by using Twig extension in my HTML file. I followed this guide. https://cameronspear.com/craft-cms-twig-filter-extension/ But when I run <p>{{ 123 | ...
2
votes
1answer
42 views

How can I debug `craft\web\User::_validateUserAgentAndIp()` warnings

On a production site, we're seeing a ton of the following warning in our web.log files for (seemingly) every request, creating a ton of noise in the logs and making it hard to spot "real" issues: &...
2
votes
0answers
71 views

What is the correct way to update a production site with composer?

I disable admin updates on production sites, and update Craft and its plugins by updating in the development environment, and then deploying to production using Git. My basic process starts like this:...
2
votes
0answers
157 views

How to download private assets (without public URL) from dashboard

I would like to download asset files from Craft 3 dashboard. Those files are out of web folder because of security reason. I made "documents" folder just under the root of the project, and the files ...
2
votes
0answers
112 views

Move an asset to another volume with volume specific OptimizedImages Field and on the entry a volume restricted Asset Field

I have three volumes: content, hero and overview. Each volume has his specific OptimizedImages Field(s). Asset Fields are restricted to its specific source volume. For example: A Super Table Field ...
2
votes
0answers
93 views

Diagnosing Slow Database Connection for Entries (Frontend and Craft Admin)

We have set up a remote database connection for Craft CMS so that I and my colleague can work on the same database locally. The connect seems very slow both front end and in the admin area. ...
2
votes
0answers
165 views

Group by Date Field in Element API Query

I have a custom field called releaseDate in one of my entry types. I would like to use Element API to get all the distinct years assigned to those entries. I dump all the years for all entries just ...
2
votes
0answers
92 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 ...
2
votes
0answers
325 views

Searching for Multiple Categories and Tags

I've been pulling my head for the past day on how to filter products with multiple categories. After a long search, I found and implemented on my project, Advanced Search with tags and categories It ...
2
votes
0answers
51 views

Add custom column to the orders list page

Does anybody know if it is possible to add a column to the orders list page? I can choose the 'Foo' label, but when the page want to show the orders list I get the following error: "{"error":"An ...
2
votes
0answers
40 views

Recommendations on integrating Craft 3 and FormAssembly

I was wondering if anyone could give me some advice. We have a client that we are in the process of moving away from a Drupal build to a new Craft build, however, they have a large number of forms ...
2
votes
0answers
80 views

Track downloads on assets

I need to figure out if there's a way to track the amount of times an asset was downloaded. I need to display this in the back end on the site. I don't need to display it anywhere but on the back end ...
2
votes
0answers
328 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 ...
2
votes
0answers
46 views

Creating an archive with linked asset

I'm trying to create an archive of PDF newsletters in Craft 3. I want to create a list of entries sorted by month and year. Then each year would appear separately. Finally, I want each asset within ...
2
votes
0answers
320 views

Craft Commerce 2: Adding subscriptions to cart

I am porting a Shopify "multi-site" to CraftCMS using Commerce and I need to be able to add subscriptions to the shopping cart (customers can subscribe to a monthly box), together with other products. ...
2
votes
0answers
458 views

Craft 3 Plugin - Only default action works

I'm working on a Cloudflare integration plugin for Craft 3. I set up the plugin with settings, which works fine so far. Now I intended to verify the Cloudflare credentials using an AJAX call. I set ...
2
votes
0answers
323 views

Can't find assets publicly via URL

Basically, I have an asset volume called Images, with base URL: /photos/ file system path: ~media/images Then I go to upload the asset and I try to view it, it gives me a 404 "Template not Found" ...
1
vote
0answers
15 views

Prevent Redactor from stripping tags like <span>

Is there any possible way to prevent <span> tags from being stripped from a Redactor field? I've tried all I can using custom Redactor and HTMLPurifier configs to no avail. Basically what I'm ...
1
vote
0answers
9 views

Is any way to add translations for Braintree Gateway dropin interface?

The correct way to add translation to an instance of braintree.dropin is to add options.translations array when calling the braintree.dropin.create method, for example: if ($dropinUi.data('locale') =...
1
vote
0answers
24 views

Cannot get asset from custom user field, with no-admin account

I would like to get a file of custom user field, which is "asset", and provide a link to the file for the user. However, the asset file cannot be gotten. The length of the asset field is zero. In ...
1
vote
0answers
21 views

Craft Table/Tabular static entry input field

Is there a way to set up a Craft CMS entry field to have a table with predefined rows and columns? I have tried with the native Craft Table field, but it allows users to add rows or edit default ...
1
vote
0answers
26 views

Craft 3 memcached session storage in load balanced environment

I'm getting the good old session expired popup every minute in the admin panel which is odd given that memcached should be properly configured: php.ini session.auto_start = 0 session.save_handler=...
1
vote
0answers
26 views

Using multiple elementTypes in Element API

I am currently trying to create an autocomplete search with the element-api. I need results from two different elementTypes: Product::class Entry::class How do I get results out of both elementTypes ...
1
vote
1answer
30 views

How to build a web page using different sections created in craft

I am a beginner in Craft. I have a Craft website. There is an HTML design with me. From admin, I divided the HTML into sections and created entries based on that. All the coding related to each ...
1
vote
1answer
21 views

ERROR 1370 (42000) alter routine command denied to user

I am trying to upload my DB using MySQL Workbench but am getting this error: ERROR 1370 (42000) at line 4534: alter routine command denied to user 'detectalocal'@'%' for routine 'detectalocal....
1
vote
0answers
28 views

“Could not find composer.json file” error in CraftCMS 3

I recently updated my CraftCMS 3 with the help of Composer. When I try to install a plugin with the plugin store, I get an error saying that Craft couldn't find my composer.json file. He proposes me ...
1
vote
1answer
13 views

Search return wrong result with special character like @#! in Craft 3

I have implemented search in Craft 3, but it returns wrong result when I enter some special characters like @#!. Is there a way to prevent it?
1
vote
0answers
12 views

Modify preview targets and save them

I'm using the following Event hook : Event::on(Entry::class, Entry::EVENT_REGISTER_PREVIEW_TARGETS, function ($event) { } The $event variable contains an array with the current $previewTargets as ...
1
vote
0answers
12 views

Limitation on number of users for Craft Calendar 2.x

We are considering using Solspace Craft Calendar 2.x for our new start up users to use as a rostering tool. Is there any limitation on number of users we can subscribe to use Calendar 2.x? We are ...
1
vote
0answers
58 views

change core element index pages

Is it possible to change core elements index pages -like entry index page- by plugin in PHP way, like extending their twig, using events, hooks and not manipulating DOM with Javascript? Currently ...
1
vote
0answers
8 views

How to auto disable “Enabled for Site” for certain sites (or groups) when creating a new entry

We have a mutli-country/language website with Craft 3 for many countries/languages. When we create an entry (ecommerce product to be exact) in the English sites we dont want to enable it for other ...
1
vote
0answers
23 views

Freeform Lite - Dynamic Notifications

I am wondering if you can offer some help with an issues I am having. I am using Freeform Lite and I have a hidden field with the entry title as the value. Is it possible to use that value for ...
1
vote
0answers
42 views

Craft 3, Freeform form not submitting file upload

I have a simple form with a file upload field in built with the latest version of Craft 3 and Freeform and I haven't been able to get the file upload to the field to work. When you submit the form ...
1
vote
0answers
28 views

Craft 3 multisite: site specific config

I'm trying to do something like this in general.php config for a multi-site setup: // ... 'production' => array( 'myVariable' => array( 'site1Handle' => '111', '...
1
vote
0answers
27 views

Ad Wizard custom field asset

I'm using plugin Ad Wizard, supported custom fields. Trying include additional asset field for html5 animated banners. Here is dump array: ["groupId"]=> string(1) "1" ["assetId"]=> ...
1
vote
0answers
20 views

Getting value from response (Craft Commerce)

I'm in the process of adapting the old RealEx gateway to work in Commerce 2 since that's what we're using and there isn't native support in V2. I've got payments and 3D secure working, now I'm trying ...
1
vote
0answers
22 views

Craft 3 Image Editor / Redactor - Remove?

TL;DR Can the button for "Image Editor" be removed from Redactor in Craft 3? I've looked around the Craft docs and web, but I can't find a way to remove the button that appears within the Redactor ...
1
vote
0answers
20 views

Filtering Entries based on Amenities (Category)

Hello and thank you in advance. I have a page that lists hotels by region. On the initial load of the page I am able to render all the hotels by region in a tabbed format. This part of the page works ...
1
vote
1answer
24 views

Store phonetics in plain text field

I need to store phonetics for word definitions in a plain text field. An example would be something like "Craft Website" => \ ˈkraft ˈweb-ˌsīt \, like you'd see in a dictionary. If I try saving \ ...
1
vote
1answer
53 views

Disable activation link email for a specific user group

I am developing a website which is having two user groups. The users of first user group will have self activation email with account activation link while second user group will be activated by admin ...
1
vote
0answers
46 views

Craft Commerce Adjuster API/PHP questions

I've got a module set up to add discounts based on criteria defined in a category group (handle 'productPacks') -> category (which is a "pack"). Now, everything works great for one type of pack, and ...
1
vote
0answers
29 views

Webhooks: Filter Entry by type (or Section)

Using the Webhooks Plug-in, I'm looking to specify a "scope" (or filter) for content type (or section) when using the saveEntry event. Example: Fire a webhook only when a new entry of specific type (...
1
vote
0answers
64 views

Entries as JSON files?

I work with VUE CLI and I want to build a entry form. My first Idea to bind in the data was props. They work but i can't modify the data (because it's props :D). To correctly integrate the data, my ...
1
vote
1answer
44 views

Craft 3: Searching within back-end & front-end isn't giving all entries/results

Searching within Control Panel as well as the front-end is not going through all entries. When I try searching in the Content tab I see the pages are listed but when I try to search for the entry it ...
1
vote
0answers
19 views

Craft Commerce: Create new shipping zone by excluding other zones

I need to create 3 shipping zones in Craft Commerce 2 (currently on v2.1.7): UK Europe Rest Of The World Having to manually add the countries to the UK and Europe zones isn't too much of an issue, ...
1
vote
1answer
45 views

in a for loop, how do i only display entries of a certain category?

I see a few answers that look, hopefully, way more complicated than I'm looking for. I simply want to loop through entries with a normal for loop like: {% for entry in craft.entries.section('News')....