Questions tagged [plugin-development]

Questions having to do with constructing plugins.

Filter by
Sorted by
Tagged with
0
votes
1answer
21 views

All Plugins Showing "Not Installed" After Promoting Changes From Dev to Stage Environments

We are using the custom exec widget to move the codebase, backend fields, section creations, and images from one environment to another. We have Dev, Stage, and Production environments. After ...
3
votes
3answers
584 views

Show field handles on control panel

As someone relatively new to Craft I'm constantly switching between a content type and /admin/settings/fields so that I can see the handles for that content type. It just occurred to me that it would ...
0
votes
0answers
31 views

How can we create the Martix type field?

In Plugin development, I have created a field, Is it possible to create a field as a matrix field or I will have to create custom add more functionality?
0
votes
1answer
51 views

Posting data from CP to Plugin controller results in server error 500

I am currently trying to write my 1st Craft plugin. The goal (simplified): Backend users select a bunch of pages in the CP, and create a PDF. The result is an annual report that's optimized for print (...
1
vote
1answer
25 views

How to display controller response on twig template?

In the plugin, I created a form and after the process, return the below response from the controller and redirect to the template. I am trying to print the response to the template but it's not ...
1
vote
1answer
27 views

Create a channel programmatically

I am diving into Craft plugin development and there is one thing that I want to achieve, but I didn't find any documentation. I managed to save specific new entries into a channel using saveElement(), ...
0
votes
0answers
36 views

Guzzle fatal error using Craft Guzzle client

Using the code below to get 3rd party API $uri = $baseUri . '/area/' . $areaId . '.geojson?api_key=' . $mapAPIkey; $client = Craft::createGuzzleClient(); $response= $client->request('...
1
vote
2answers
30 views

Running a background job in a controller

I am trying to run a background job in a controller but wondering if its actually possible. I'm not sure about namespacing and could do with some guidance on whether the job should be running in the ...
0
votes
0answers
9 views

Running a a join query in a plugin with a background job API call

I'm working on a plugin and need some steering. I have two sets of entries that are linked by a foreign key value. (They are not related entries but lsoaname value corresponds to a field in 2nd set of ...
2
votes
2answers
690 views

Craft 3 plugin - how to update entry with field of Entries type

Using PHP, I want to update a field of Entries type of an existing entry. Fields of type Text and Number will update with the following code: $entry = Entry::find()->id($entryId)->one(); $...
1
vote
1answer
33 views

Why do i get an Invalid route error in cp when calling plugin action?

I have a plugin that has a menu and in backend which basically has a button that calls the plugins default controller actionXXXX method. The action does some database / api work then is meant to ...
1
vote
1answer
17 views

Can some one explain Event rules in plugins

So here is what I see in a controller: $event->rules['cpActionTrigger1'] = 'plugin/default/do-something'; What does the first part 'cpActionTrigger1' refer to and what does the second part refer ...
0
votes
0answers
13 views

Include File In Multiple Plug-Ins

In Craft 2, I would like to share the same include file among several different plug-ins. Is this possible, and, if so, where in the directory structure would that include file go? Thanks
1
vote
1answer
25 views

How to loop through specific entries in plugin and edit and save

I want to update some custom field values on my Entries with data from a third-party API, via a Plugin or Module. How do I load the relevant Entries, and one-by-one set and save the new data in my ...
0
votes
0answers
13 views

OAuth Client library query

We are looking into extending the venveo/craft-oauthclient plugin to use the TheNetworg/oauth2-azure Provider. However we need to set this up to authenticate via the client_credentials grant type as ...
1
vote
1answer
13 views

Multiple shipping method for a single order

We have a website with Craft CMS. We sell and export goods to different countries. Our customers can select multiple shipping method. For example if they had 10 different item on cart, they could ...
0
votes
1answer
22 views

How to alter CP entry edit form

On an entry edit form I'd like to alter the options in a multiselect field to be user relative. Is there something like a form_alter hook?
1
vote
1answer
33 views

Loading JavaScript on Template Load

I'm working on a kiosk-type plugin which will cycle through all news entries, beginning upon template (or page) load. It needs to load a JavaScript ajax script for this on page/template load. Would ...
0
votes
1answer
15 views

How can I revert a migrations from the control panel?

Is it possible to revert a migrations from the control panel?
1
vote
1answer
20 views

I am working on a plugin and I have to use a method of one controller in another controller's method?

As I have a method name statistics() in my defaultController and I have to use the same method in viewController is there any way to do so?
1
vote
1answer
28 views

Can't register custom adjuster with Craft CMS commerce

following https://craftcms.com/docs/commerce/3.x/extend/adjusters.html#writing-an-adjuster I am trying to make a custom adjuster: I placed class myPlugin extends Plugin{ Event::on( ...
1
vote
2answers
378 views

Editing a users custom fields from a plugin action Craft 3

Does anyone know if there is a block on updating users form an action? Trying to update a users custom field in craft 3 via plugin in the admin. The admin template calls an ajax call to the action ...
0
votes
0answers
66 views

"RuntimeException" Could not scan for classes inside "vendor/google/apiclient/src/Google" which does not appear to be a file nor a folder

I am using the google-client library in my plugin but it is working in my local system, and when I try to live it on plugin store so only main project composer is updated and then giving this error &...
0
votes
0answers
12 views

Testing adding fields to an entry type field layout

I'm writing unit tests for a plugin that reacts to adding fields to field layouts, I'm trying to add fields to a layout programmatically but can't get anywhere, In the example below (method ...
0
votes
0answers
9 views

Query date field, timezone not taken into consideration

I'm trying to query a custom table on a DATETIME field. My timezone is UTC+2 and the dates stored in the database are UTC. shiftEnd in database: note that the shifts ends at 08:35 UTC, in my timezone ...
1
vote
1answer
20 views

Install a plugin in a unit test

I'm writing some unit tests for a plugin I've made using codeception. I need to test the installation of another plugin during a test. Defining the plugin in codeception.yml doesn't work, the plugin ...
1
vote
1answer
96 views

Updating private repo plugins from admin?

Is it possible to update private repo plugins from the admin at all? Would love that functionality, especially for smaller projects that are installed where there's no CLI access.
2
votes
1answer
46 views

Adding column to CP entries without writing plugin?

Is there a way to add a column to the control panel display of entries? I would strongly prefer to not write a plug-in for this. The contents in the column would be nothing more than a button that ...
1
vote
1answer
29 views

UrlManager::EVENT_REGISTER_CP_URL_RULES event not firing in custom plugin

I'm working on building out a custom plugin for Craft 3 to create a new element type called Events. Following the Craft docs for creating edit pages, I hit the point where I'm trying to register my ...
4
votes
1answer
285 views

Using plugin template on front end

I'm working on a plugin called modelselector and I want to use a template stored in the plugin templates folder but it should be shown on the front-end of the website. Currently the following direct ...
1
vote
1answer
64 views

How to auto enable a plugin after install?

I am developing a plugin for craft 3 and the plugin just got published to the store. I can browse through the store and install the plugin but it stays disabled. The user will have to goto Settings -&...
1
vote
1answer
42 views

What is the best way to create a designed Facebook feed on Craft CMS website?

Hi I'm looking for recommendations as to how to create a designed Facebook feed on the home page of a Craft CMS website please? I'm not a big fan of them but the client has requested it and it's a ...
1
vote
1answer
45 views

How to build a custom fieldtype containing multiple nested groups of text and dropdown pairs?

I'm working on what I thought would be a relatively simple plugin; a custom fieldtype that would have 8 "sub-groups", each of which would consist of a numeric text field and a dropdown field ...
3
votes
3answers
812 views

How do you save a new Entry to be enabled on 2+ Sites?

I've made a plugin that let's you import Entries from a CSV file and I'm working through adding localization (Sites) support to it, but I can't figure out the right way to enable an Entry for a second ...
0
votes
0answers
10 views

Check Laravel auth status from Craft

I'm working on a Laravel/Craft integration project, where I have to check if a user is authenticated on a Laravel app running on the same site. So far, I've managed to load Laravel inside a plugin ...
1
vote
1answer
44 views

Sequential numbering from global field

I would like to add sequential numbering to each entry, which is obtained from a global field. After saving the entry, the global field should be assigned the next number (+1). Does anyone have any ...
0
votes
0answers
27 views

Change value before save settings (Plugin Development)

I want to check if an API is succesfully connected if yes then i want to save the connection status on my plugin settings. inside this class: class Settings extends Model i tried this code: public ...
0
votes
0answers
19 views

Adding A Soft Delete in Craft 2 Entries

I've been thinking of adding a "Soft Delete" or just perhaps a means in which deleting in certain sections (e.g. News) will archive the entry with an update, rather than deleting it. As I ...
10
votes
5answers
6k views

What's the best way to skip CSRF for plugin controllers?

I'm working on a plugin that'll create a private API for content authors to post entries to Craft from desktop-based scripts. These scripts post data to plugin controller actions (anonymous-allowed), ...
2
votes
1answer
52 views

Retrieving entry just after saving it returns null

I'm having this issue where when I save an Entry and try to fetch right away I get a null. Example: $entry = new Entry([stuff here]); $entry->title = 'foo'; if (!Craft::$app->elements->...
4
votes
1answer
2k views

Craft 3 - Save new Entry with Relations (Categories/Assets)

i simply can not get my "job" done. I try to create a plugin for Craft, a simple one. It reads some date and should create new entries out of this data. First i stuck on a stupid save-mistake, someone ...
1
vote
1answer
39 views

Programatically create a Neo block with children

I already discovered how to create a neo block programmatically from this post: How can I set a Neo field's values from my plugin/module? However, I don't know how I can create a neo block with ...
1
vote
1answer
62 views

Trouble with Custom Command in Custom Plugin. How do I do it?

I found the documentation here very confusing: https://craftcms.com/docs/3.x/extend/commands.html#module-setup I've scaffolded a simple test plugin from https://pluginfactory.io/ with "Console ...
0
votes
0answers
21 views

Commerce module - update purchasable ID on save line item

I'm trying to update a purchasableId against a line item (eg if the variant changes) via a custom module/controller (long story short native controller is not updating options stored against against ...
1
vote
0answers
19 views

Removing or hiding certain fields from the CP new entry for a specific user group

I'm trying to make some fields unavailable for a certain user group when they create or edit a new entry. These fields should only be available to admin users. I had implemented this by extending the ...
1
vote
1answer
50 views

Listening for Change at Entry Save

I want to send an email if/when an entry is saved with a lightswitch switched on after previously being off. I have the below code in my plugin's init file, but I don't know how to check for the ...
1
vote
0answers
29 views

Is there a way to prompt for confirmation in cp?

I have a custom plugin that checks for assets filename, and I'd like to prompt for confirmation like in the example below. Is there a way to do that in Cp? If user clicks No then $event->isValid = ...
1
vote
0answers
81 views

Craft warning: Tried to release a savepoint, but it does not exist

I'm working on a plug-in for Craft 3. For this plug-in is a migration is needed. When this migration runs and adds the entries, fields, and groups then the following warning occurs in the logs. [...
4
votes
2answers
951 views

Allow user to delete their own account from the front end

I'd like to allow a non-admin user to remove their own account from the front end of my app, without allowing them CP access. I'm concerned that if I give the user group deleteUser permissions they ...

1
2 3 4 5
35