Questions tagged [plugin-development]

Questions having to do with constructing plugins.

Filter by
Sorted by
Tagged with
1
vote
1answer
21 views

Save metadata on entry without creating a corresponding field

I am trying to add a seeded:true flag to dummy entries seeded during development, so I can automatically weed (delete) them later when I'm ready to save the actual live content. I know I can create a ...
1
vote
1answer
12 views

How can I see what fields changed on EVENT_BOEFORE_SAVE and or EVENT_AFTER_SAVE

I want to see what data is changing whenever someone is updating an element to act on the difference between the states. In this particular case a User, but more abstractly speaking, an element. In ...
1
vote
1answer
13 views

upload base64 image -> save in assets -> custom plugin

I started coding a custom plugin, it takes a video file from the asset and showing the file in a video-player (CP). The user is now able to take screenshots of the video (using JS) by clicking a ...
1
vote
1answer
25 views

Upload asset via API - Asset saved under root folder

I am trying to seed some images to an existing volume programmatically. The code I'm using is taken (almost) verbatim from Craft's AssetsController@actionUpload: $filename = Assets::...
1
vote
1answer
19 views

Check for existing jobs in queue

Is it possible in code to search for a job/list out all jobs? I have built a plugin that scans an external API and I want to scan on an interval as well as allow the user to fire off a manual scan. I ...
1
vote
1answer
36 views

Install plugin from another plugin

I'm trying to use Redactor as a dependency for a plugin I'm writing. I need it to be installed before I run my Install.php migration, because in the migration I'm creating a Redactor field. Following ...
1
vote
1answer
69 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 -&...
0
votes
0answers
23 views

getDirtyFields returning more results than expected

I have a module that sends an email whenever a specific entry field is updated. Everything is working fine except that the field is being passed to the dirtyFields array even if it has not been ...
0
votes
0answers
19 views

Send email from two different addresses using SMTP

I have a configured and fully working Craft 2 website that sends emails using the SMTP settings I have set in the admin panel. I am in need to send a specific email in a certain situation from a ...
1
vote
1answer
12 views

Composer Unexpected end of file on new plugin

I'm making a new Plugin for CraftCMS, it works fine locally but when I call the services class on our staging server it throws a Syntax Error, Unexpected end of file. I've installed them both through ...
0
votes
1answer
67 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
32 views

Manipulating search event

Looking at a means to perform subqueries against certain searches in the back-end of the Craft CMS eg for searches against particular sections within Admin > Entries. Looking into this it seems ...
1
vote
1answer
11 views

Limit elementSelectField to specific sections

How do I limit this elementSelectField to only allow entries within a certain section? {{ forms.elementSelectField({ label: 'Blog post', name: 'blogpost', elementType: 'craft\\elements\\Entry', ...
1
vote
1answer
25 views

How do I renew Craft CMS license?

When I go to Updates in my home Dashboard, I see there are "5 updates available!" I click "Go to Updates" and a big orange ribbon pops up that reads: Your license has expired! ...
4
votes
1answer
379 views

Set execution order of plugins listening to same event

I have 2 separate plugins that listen to same event. Now I want to make sure Plugin B starts its action only after Plugin A has finished its job. Is there a way in Craft CMS to set priority / ...
0
votes
1answer
27 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
604 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
32 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?
1
vote
1answer
27 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
28 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
45 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
33 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
734 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
52 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
24 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
31 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
14 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
15 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
35 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
16 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
37 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
413 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
89 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
14 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
22 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
52 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
35 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
296 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
53 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
48 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
843 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
46 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 ...

1
2 3 4 5
35