Questions tagged [plugin-development]

Questions having to do with constructing plugins.

Filter by
Sorted by
Tagged with
2
votes
1answer
22 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
20 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
36 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
22 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
24 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
17 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
51 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
22 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
14 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
16 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
26 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
41 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
48 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
28 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
29 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
28 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
44 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
43 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
16 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
34 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
32 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
37 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
39 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
58 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 ...
2
votes
2answers
90 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
56 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
53 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
19 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
35 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
50 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
19 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
35 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
48 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
54 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
75 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
50 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
54 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 ...
1
vote
0answers
52 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
40 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 ...

1
2 3 4 5
34