Questions tagged [controller]

The tag has no usage guidance.

16 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
2
votes
0answers
572 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 ...
1
vote
0answers
34 views

404 error when trying to access a module controller action

I’m creating a module for a site for the first time and I’m having some trouble figuring out how to get the correct action url for my controller. I’m using this template for setting up the module: ...
1
vote
0answers
17 views

Optimising entries fetching in php

First of all, the last time I did php was 10 years ago in school, so I'm basically a noob :D I have two channels, let's say shops and products. Shops contains a matrix field composed of a product ...
1
vote
0answers
45 views

How can I override the Response status text from a controller?

I'm trying to set the statusText in a response, from a module controller. E.g.: <?php namespace modules\appmodule\controllers; use Craft; use craft\web\Response; class StatusController extends ...
1
vote
0answers
501 views

Unable to call a service method from controller in my custom plugin

I know there are similar questions here, but I don't see a definitive answer, nor one that works for me. I've generated a plugin via pluginfactory.io, which has some controllers and a single service. ...
1
vote
0answers
532 views

Plugin Development (Craft 3): Pass variables with redirection

I'm building out a Craft 3 plugin and can't see who to pass variables with redirection from a controller. For example, I have a controller that I want to pass back to the defined redirect value ...
1
vote
0answers
45 views

Find category through ajax using ElementCriteriaModel

I'm trying to run a controller action with ajax in a new plugin I'm making. The action needs to return all categories from a group, so nothing impossible here. When I run the actionUrl in the ...
1
vote
0answers
1k views

var_export does not handle circular references” when devMode = true and logDumpMethod = print_r

Here is a similar question that was asked but doesn't resolve my issue Question has changed, see UPDATE below I'm new here so I couldn't just tag a comment onto this post asking this question: I ...
0
votes
0answers
10 views

How can I override the language and locale before rendering a template?

I render a template by a controller and it supposed to be rendered by a specific language and locale formatting regardless of current user's language or locale. Is it possible to override the language ...
0
votes
0answers
10 views

Proper way to pass matrix fields to Javascript

I'm working on a semi-headless solution with Vue frontend. The problem is the Matrix field. How to properly pass this from the Controller in PHP to Javascript/Vue frontend? With all its possible extra ...
0
votes
0answers
9 views

Display debug toolbar in controllers

I created a controller that returns XML and is not related to Twig rendering in any way. Can I still display the debug toolbar when I enter this controller URL to check if my database queries are ...
0
votes
0answers
17 views

htpasswd exception for controller

I'm wondering if anyone's using .htpasswd for basic site security for a staging site that's in review (where we're testing front-end registrations so we don't want to force control panel logins, ...
0
votes
0answers
37 views

How can I add data to a matrix field from a module without overwriting existing data?

I have an entry that has a matrix field. From a controller in a module I want to add additional data to it (e.g. some text that I have in a variable $messageText) but without overwriting the existing ...
0
votes
0answers
19 views

Programmatically set a field from the Sprout Fields plugin

We are building a custom frontend form allowing users to create their own entries. How can we set the sprout fields programmatically in the backend? This is what we have tried so far with the phone ...
0
votes
0answers
34 views

How can I get uploaded images from my controller and upload them to Craft?

I'm using dropzone to upload images on my front-end. The form action url is to my controller from a custom plugin and that works fine. However, now I'm trying to get the files from dropzone (a json ...
0
votes
0answers
17 views

Extending Craft controller classes and using private methods in child class

I created Controller that exptends Craft AssetsController. Hovewer some of AssetsController methods are private - and I cannot use them using $this context in child module, so i just copied them to ...