Questions tagged [plugin-development]

Questions having to do with constructing plugins.

Filter by
Sorted by
Tagged with
0
votes
0answers
4 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 ...
0
votes
1answer
13 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
1answer
16 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 ...
0
votes
0answers
11 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
0
votes
0answers
11 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
21 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
1answer
12 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
19 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?
0
votes
1answer
14 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
32 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 ...
1
vote
1answer
19 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
24 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( ...
0
votes
0answers
32 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
9 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
7 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
18 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 ...
2
votes
1answer
43 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
27 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 ...
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 ...
1
vote
1answer
37 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 ...
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
26 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 ...
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->...
1
vote
1answer
33 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 ...
0
votes
0answers
18 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
17 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
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
1answer
53 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 ...
1
vote
0answers
69 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. [...
0
votes
1answer
22 views

Add a form field into the details bar on the entry edit screen and do something with the value

I'd like to add a form field into the details bar on the entry edit page, so that when the entry gets submitted, the form field value gets passed into the data payload so that I can pick it up from ...
1
vote
1answer
29 views

How to remove category link from redactor links but leave assets and entry link

This is a follow up from How to remove Link To Category from Redactor. I've been able to setup the module and remove all links with this: Event::on( RedactorField::class, RedactorField::...
2
votes
1answer
30 views

How to create a new Tag group and save it?

I'm new to the Craft CMS framework and have a question about tags. How can I create a new tag group? You can create a tag list by hand via the admin panel > settings > Tag Groups > New Tag ...
0
votes
0answers
29 views

How to create structured elements

I'm quite new here, so I hope this is not a too newbie question: I'm currently developing a plugin and want a similar view like in Entries > Structures, so I can sort and create children of my ...
1
vote
1answer
48 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 ...
2
votes
1answer
28 views

Plugin record no dateUpdated and uid

I'm building a small analytics plugin and as such, I don't need the dateUpdated and uid columns in my records, but I dind't find any way of disabling them. Currently I have tried: Not setting them in ...
0
votes
0answers
30 views

How to convert custom plugins to custom modules

I have 3 custom plugins that we had someone develop for us a while ago and I would like to convert them to custom modules. Since plugins are based upon modules, I was hoping there might be a cookbook ...
0
votes
0answers
7 views

How do I set site-specific field data via a plugin

I'm writing a custom importer plugin. How do I import localized content into different Craft 3 sites? Specifically, I'm writing to a Matrix field. I've used https://craftcms.stackexchange.com/a/1414/...
2
votes
1answer
48 views

Editing SuperTable inside Matrix block

I have a matrix field set up as global (strategies). Inside each matrix block there is a SuperTable (pairs) On each row in the SuperTable there is a lightswitch (active) I need to toggle the ...
0
votes
0answers
18 views

Super table field in the element index table page (defineTableAttributes)

I've built a Custom Element called Contact and I've defined almost all the functions it needs including Contact::defineTableAttributes(). My question is two folds: How can I have my plugin install ...
1
vote
1answer
49 views

Use .env values in Craft 3 plugin settings

I’m writing a plugin and need some of its settings to be pulled from the .env file. According to the docs the following should work, but the getter isn’t getting called whenever the plugin’s ...
2
votes
1answer
37 views

Apply custom filter on the entries in admin control panel using custom plugin in craft cms 3.5

I was referring to Filter entries in the CP based on custom permission and Filter entries in the CP based on custom permission It seems onBuildElementsQuery was available only in 2.x. Is there any ...
1
vote
1answer
21 views

Removing the Save button based on some condition

I want to remove the Create button of an entry based on some condition (review states) for some users. Is there a way to hook in within a module?
0
votes
1answer
49 views

How to properly change / add to CP HTML

I'm making a change to the CP so that clicking an asset thumbnail from the asset preview HUD will open the asset in a new tab. Specifically, I'm changing line 1685 of craftcms/cms/src/elements/Asset....
1
vote
2answers
45 views

Custom plugin settings add on admin nav bar

I want to control my plugin on the admin navbar but I can't found a way for that.
1
vote
2answers
19 views

Plugin Settings Color Input Javascript Event Listeners

Is it possible to attach JavaScript event listeners to the colour input field in a plugin's settings page, so that when a user selects a colour with the picker I can run an AJAX request?
1
vote
1answer
63 views

Getting unknown property: craft\feedme\events\FieldEvent::fieldValue

Getting a strange error when trying to check if a field is null when importing via FeedMe Getting unknown property: craft\feedme\events\FieldEvent::fieldValue use yii\base\Event; use craft\feedme\...
0
votes
0answers
17 views

Craft Commerce: Wrong payment currencies in orders

I have Craft Commerce installed on my site (which uses Craft CMS 3.5.14). I have set up multiple payment currencies for it (NZD - which is the base currency, AUD, EUR, GBP, JPY, USD). When I go to ...

1
2 3 4 5
35