Questions tagged [plugin-development]

Questions having to do with constructing plugins.

Filter by
Sorted by
Tagged with
1
vote
0answers
11 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
17 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
16 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
13 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
20 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
22 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
25 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
25 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
34 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
26 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
27 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
6 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/...
1
vote
1answer
29 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
13 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
28 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
26 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
16 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
32 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
35 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
18 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
52 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
16 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 ...
2
votes
2answers
80 views

Feedme Skip Entry if No Matching Elements on Field

Is there a way on Feedme to not import an entry if it doesn't have a match on a specific field? e.g. If there is no entry that it matches up to, don't import it. Here's the current code I have: ...
1
vote
1answer
47 views

Can I apply adjustments (discounts) through a controller?

I have a controller which when called (actions/some-module/discount-link/apply?code=abc) associates abc with an entry and based on some stuff in that entry populates the cart with some specific ...
1
vote
1answer
46 views

FeedMe Change Slug when Importing

I asked this question previously before Feedme was acquired by Craft, though I haven't updated Feedme & the code since now. I'm getting the following error when processing my feeds. I'm trying to ...
1
vote
1answer
16 views

Running plugin migrations when other plugin is installed?

I'm creating a plugin (A) that has optional support for another 3rd party plugin (B). When my plugin A is installed, I create a number of tables. If plugin B is also installed my migrations create ...
2
votes
1answer
30 views

Partially pay for an order

Is there any way of partially paying for an order, so if the order total amount was $100, how can I programmatically set the payment amount to $50, and then pay the other $50 using another payment ...
0
votes
1answer
47 views

$this->renderTemplate() breaks the CP navigation

I'm locally working on a Craft Plugin with a Page in the Control Panel where I have a form that posts to a controller. <form action="/actions/import-products/product/create" method="...
1
vote
1answer
18 views

dev- branch plugin forks being prompted for update

I'm currently using a fork of a plugin for my site, and using a "dev-[branch-name]" version specification in the composer "require" block, with a "vcs" repository ...
1
vote
1answer
26 views

Hide/show element actions dependent on tab

I have a custom element index with an element action to 'Approve' elements. The element index has 'Live' and 'Staged' sources. Where/how do I set it to only show this action on the 'staged' source OR ...
1
vote
1answer
40 views

Updating plugin/module config via template/controller

I have a plugin/module that synchronises local records with a Google Sheet managed by the client. The URL for this doc is stored in a module config. I want the client to be able to update this via the ...
1
vote
1answer
53 views

Element type with 'baked-in' fields

I've created an element type and want to have a 'Categories' and 'Tags' field built-in (the sources for each will be selectable in settings), but can't figure out the best way to go about this whilst ...
0
votes
1answer
59 views

Schedule plugin not working for Feed Me plugin

I have created a schedule to run the 'Feed Me' every 1 minute using the plugin 'Schedule', but it doesn't work. I not sure am I using the correct setting or not. I manage to get the latest data if I ...
1
vote
1answer
42 views

Creating a calendar event from within a plugin (stuck on saving)

I'm trying to create an event from within a plugin. I've come up with the following: $event = new Event(); // Solspace\Calendar\Elements\Event; $event->authorId = 1; $event->calendarId = 5; $...
1
vote
1answer
47 views

Eager load commerce order data in custom ElementExporter for Users

I have a custom ElementExporter for users and I'd like to include commerce order data. The below code works, but it's a ton of queries. I don't have a ton of experience with SQL queries, how can this ...
0
votes
0answers
43 views

Saving custom element types

i have created my first plugin and have hit a bit of a wall... its a plugin with a custom element type, i have it creating its own database table (migrations/install.php) and i have the form ...
1
vote
1answer
19 views

Archiving custom element types

I am building a custom element type and want to have the ability to archive entries. I can create a custom status for 'archived' but I've noticed base elements already have an 'archived' status I ...
1
vote
1answer
28 views

returning HTML in $event->sender->addErrors doesn't work

I have a plugin which is checking if there is a duplicate entry before save. I'm trying to give the user back an anchor to the entry which exists so my client can switch without searching for it in a ...
0
votes
0answers
16 views

Custom Plugin forms.textareaField Redactor buttons not rendering

I am struggling with how to get Redactor to show the source and image buttons within a custom plugin. Are there only certain buttons that are allowed if you are extending textareaField? Below is the ...
2
votes
1answer
31 views

Programatically setting dropdown options in a matrix

I'm building a Matrix field from within a module's migration. I can get all fields setup correctly except the options of either a Dropdown or Checkboxes field. $field = new \craft\fields\Matrix([ '...
0
votes
0answers
18 views

How to override filename saved in Sprout Forms?

After a form is saved I need to concatenate together the {{proposalCompanyName}} handle with the {{proposalFileUpload}} handle so that the saved filename in the Assets folder is proposalCompanyName....
0
votes
1answer
88 views

Rendering a template from a controller - unable to find template

Once again going out of my mind trying to figure something out... I have a custom controller which I want to return a rendered template. The template should, ideally, reside in my front end templates ...
2
votes
1answer
40 views

unsucessful setFieldValues after programatically creating field on a migration

as part of a migration script I'm trying to: create 2 new fields, add them to a field group add the new fields to a specific tab on an entry type Update the values of the new fields What I have so ...
2
votes
1answer
29 views

Licence error and update issue cause of same plugin name / handle

We developed a plugin with the name "poll" (composer.json: webhub/poll) for one single project. Now we get the licence error in the control panel, cause there is a plugin to buy which has ...
0
votes
0answers
55 views

Plugin: Record relationship with Entry

I'm trying to build a plugin that has relations with Craft entries. The plugin db table has field called entryId that defines a foreign key to the {{%elements}} table. Then my Record class extends ...
1
vote
2answers
69 views

What is the best way to handle HTTP requests within a plugin using Yii or Craft?

I have a custom module which is moderating content before entry save, I am looking to use a Microsoft Azure API to handle the moderation, in their documentation they use a HTTP library to make the ...
0
votes
0answers
28 views

Saving to db with devMode true works, but not when false

// Upload and save as temp file $request = Craft::$app->request; $file = UploadedFile::getInstanceByName('file'); $tempPath = $file->saveAsTempFile(); // Create as permanent asset $folder = ...
0
votes
0answers
27 views

Timezone in Craft different from timezone in plugin

In general.php I've set 'timezone' => 'Europe/Oslo'. When saving entries through the CP they are saved with the correct time. Also, date_default_timezone_get() from my plugin returns Europe/Oslo. ...
1
vote
1answer
24 views

Craft 2: possible to control plugin triggering order?

I have a Craft site which has 2 different plugins listening to the same event (the Contact Form beforeSend event). The outcome is one is being triggered before the other and this is causing issues. Is ...
1
vote
1answer
76 views

Tax validation in Craft Commerce

We have a single page checkout where the items are selected and addressed added before going to a cart summary page showing amount owed and tax due. Was confused as to why certain codes were not ...

1
2 3 4 5
34