New answers tagged

0 votes

Plugin 'editableTable' settings field returns incorrect type when empty

So the reason your code worked with Craft 3 was that it wasn't typed, so it was okay with an empty table being stored as a string. As for why your normalization via event doesn't work: Does the event ...
user avatar
0 votes

How to set up webhooks individually for each site in multi-site configuration with many customers?

First of all, using multi-site for 10 different customers doesn't sound like what it is intended to be used for. But regardless, assuming you are using the Webhooks plugin, you can create your own ...
user avatar
  • 6,341
0 votes
Accepted

Adding section to Graphql "View - Public Schema" programatically

You can query for elements (entries, users, etc.) using Craft's GraphQL API, but not for collections of elements (sections, user groups, etc.). I already answered a very similar question, see https://...
user avatar
  • 6,341
0 votes

Can't change author and dateCreated/postDate on duplicate entry action in Control Panel

I believe that there is a propogation step required during duplicating an entry. Removing the condition for !$element->propagating should make your logic work. Event::on( Elements::class, ...
user avatar
  • 6,341
0 votes

Can't access Cookie from controller in plugin

Craft uses Yii's cookie handling, which includes cookie validation, resulting in cookies being signed with a hash string. To retrieve a plaintext (unvalidated) cookie, use PHP's global variable $...
user avatar
  • 6,341
0 votes

What's the correct way to check that an asset file exists?

Using PHP's file_exists function is perfectly fine for checking this. $exists = file_exists($path);
user avatar
  • 6,341
0 votes

Craft 3 Custom Plugin: model validation

Since Craft 3.4.0 you should be using defineRules() over rules() in your model classes. Models should override this method instead of [[rules()]] so [[EVENT_DEFINE_RULES]] handlers can modify the ...
user avatar
  • 6,341
0 votes

Reordering Matrix blocks by date in the control panel when saving an entry

I managed to figure this out. Here is my working solution. Event::on(Entry::class, Element::EVENT_AFTER_PROPAGATE, function(ModelEvent $e) { // @var Entry $entry $entry = $e->sender; ...
user avatar

Top 50 recent answers are included