New answers tagged

0

After a bit of testing, it appears you don't have anything to do to have your values saved, just set them and Craft will take care of the rest. Event::on( Elements::class, Elements::EVENT_BEFORE_SAVE_ELEMENT, static function (ElementEvent $event) { $element = $event->element; if ($element instanceof ...


1

I did some looking into how the EVENT_BEFORE_SAVE is being used and whether or not we can get the entry ID, without having to over complicate things, it was better to use EVENT_AFTER_SAVE, this does mean you will have to resave the entry after saving it, in this case that is very little overhead and it is only for a certain section, if heavier stuff was ...


1

Assuming you're on the latest 3.5.x release, then my guess is you need to set the "Title Translation Method" setting for whatever Entry Type you're saving to to "Translate for each site".


1

I think you just can't: allowed field types seem to be hardcoded in craft\fields\Table::getSettingsHtml(). See https://github.com/craftcms/cms/blob/develop/src/fields/Table.php#L215 for details. You might create a CustomTable field that inherits the Table class and overrides its getSettingsHtml() methods to allow you custom field type, but that seems ...


1

I was looking for an answer to this myself and found Running module migrations It is basically saying you can only create the tables as part of your craft project - but not specific to your module. To create this project-wide migration run in your craft project folder (not your module folder): php craft migrate/create [my_migration_name] This will create ...


Top 50 recent answers are included