2

I've given up on this, from what I've looked at it's not going to be easy without a migration that creates the fields first (don't really want to do this for updatability issues). I've changed the scope of the plugin to be more bare-bones, and I think it's better for it.


1

Ok, I found this: https://docs.craftcms.com/api/v3/craft-services-elements.html#method-getallelementtypes Craft::$app->getElements()->getAllElementTypes()


1

Since this is a module rather than a plugin, you need to register control panel template roots, like so: Event::on( View::class, View::EVENT_REGISTER_CP_TEMPLATE_ROOTS, function (RegisterTemplateRootsEvent $e) { $e->roots['app-module'] = __DIR__ . '/templates/cp'; } ); (I've swapped 'custom' for 'app-module' as I think it's a ...


1

Example: do nothing if element is not Entry if (!$event->element instanceof \craft\elements\Entry) { return; }


Only top voted, non community-wiki answers of a minimum length are eligible