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 [modules]

Questions related to Craft 3 Yii Module Development

0
votes
0answers
20 views

How to exclude some fields from the searchindex using the RegisterElementSearchableAttributesEvent event?

Context I had big issues on a Craft 2 multilingual site with dozens of thousands of entries that were using Matrix fields. The site had become extremely slow (almost unusable), especially when ...
1
vote
2answers
33 views

How can I use the entry UID in the entry URI

The entries in my Craft app need a unique ‘non-guessable’ URL, so I figured I could use the UID in the URI of the entry. So in the section, where I need to provide the URI format I entered "section-...
1
vote
1answer
22 views

How to enable changing the status of my own Element Type

So i have created my own Element Type and enabled statuses with the hasStatuses() method. In the ControlPanel its shown that each element has its own status, but it cant be changed. See image below: ...
1
vote
0answers
16 views

Get fields of requested entry in module

Instead of writing a lot of logic in twig in my template, I tried to create a service and get the fields related to the requested entry in a module. I then want to create a new twig variable to output ...
0
votes
0answers
34 views

Craft 3 PHPUnit: testing methods that use ->all()

In my module i've got the following method: public function transform(object $block): array { foreach ($block->accordion->all() as $element) { $accordionElements[] = [ '...
1
vote
1answer
39 views

Getting a 'ReflectionException' error, "Class modules\Module does not exist' when I change the namespace of my module in Craft 3

First attempt at making a module. So far all I've done is try to change the namespace of the template that was included with my freshly installed craft 3.0.23.1 project. Was following the official ...
0
votes
0answers
20 views

Is there a callback for post Craft 3 CMS installation I can use?

I was hoping to have my module create a few fields, sections, and entries after the Craft 3 CMS has completed it's installation. Is there a callback I can listen to that triggers after the CMS is ...
1
vote
1answer
68 views

Basic Module Tutorial or Example

I am having a difficult time understanding how to output even a simple variable using a module. Ultimately I have PHP code that I need to execute to generate a PDF. I managed to do this in V2.5. I'm ...
0
votes
1answer
20 views

Removing “action” from a module's route. Is it possible?

I have a module with a route that looks like this: http://localhost/actions/module/controller/action Is it possible to set up a custom route within my module so I can send people to: http://...
1
vote
1answer
92 views

“Template Not Found” error when trying to access a module controller action

I'm a total Craft newbie, so I hope this question isn't ridiculous. I just want to see a controller / action work in my new module. I have src/controllers/ScrapeController.php as such: <?php ...
2
votes
1answer
55 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 ...
1
vote
1answer
124 views

How to render a template from within a module?

I'm currently developing a module that contains a custom field and I'd like to create a template to be used in the getInputHtml method. I try using the Craft::$app->view->renderTemplate method ...
1
vote
1answer
51 views

How to develop plugin/module to build landingpage upon fetched JSON-data

I've developed an app which fetches data from an API based on Laravel 5.5. The marketing landingpage of the app is based on Craft CMS Version 3. The marketing website and the API and the databases of ...
3
votes
1answer
109 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 ...
0
votes
0answers
30 views

How to best run a custom PHP script in craft 3? [duplicate]

I have a php script for displaying delivery tracking information which runs independent from craft. It should run on a craft website on a specific page like so https://mypage.com/tracking/?content=...
1
vote
1answer
28 views

Craft 3 attachment email

I need to add an "attachment" to an email sent by Craft CMS 3. I used a custom "Module" for this with a "Model", "Service", "Record" and "Controller" I did some research but did not find any clear ...
1
vote
1answer
96 views

Yii Modules in Craft, samples?

Does anybody know of a collection or library of Yii Modules online? I'm trying to understand how easy they can be moved from one application to another, are we going to see something similar to the ...
1
vote
1answer
229 views

How to call Controller in Module?

I'm very new to craft and I'm having trouble finding an answer to my question (I've scoured the questions on here - but the only answers appear to be for plugins). Basically, I want to submit a form ...
1
vote
1answer
135 views

Return the contents of a template from a custom Twig function in a module?

I have a template that outputs some JSON formatted data. I've built a simple module that needs to get the contents of that template, decode the JSON data, and return it. I believe I need to use ...
1
vote
1answer
191 views

How do I load composer dependencies for a Yii module that's in my site repo?

I have a site-specific module in my modules directory that's being loaded in config/app.php. Since it won't be used elsewhere I am not storing the module in an external repository. When I added a ...